Author: jim.ma
Date: 2009-07-21 01:08:11 -0400 (Tue, 21 Jul 2009)
New Revision: 5327
Modified:
jbpm4/trunk/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/node/ProcessState.java
jbpm4/trunk/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/Jpdl3ConverterReaderTest.java
Log:
JBPM-2388:Fixed the sub-process-key in ProcessState conversion code
Modified:
jbpm4/trunk/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/node/ProcessState.java
===================================================================
---
jbpm4/trunk/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/node/ProcessState.java 2009-07-17
15:02:57 UTC (rev 5326)
+++
jbpm4/trunk/modules/migration/src/main/java/org/jbpm/jpdl/internal/convert/node/ProcessState.java 2009-07-21
05:08:11 UTC (rev 5327)
@@ -21,7 +21,7 @@
if (subProcessElement!=null) {
String subProcessName = subProcessElement.attributeValue("name");
//String subProcessVersion =
subProcessElement.attributeValue("version");
- convertedElement.attributeValue("sub-process-id", subProcessName);
+ convertedElement.addAttribute("sub-process-key", subProcessName);
}
List<VariableAccess> readVariableAccesses =
reader.convertVariableAccesses(nodeElement);
Modified:
jbpm4/trunk/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/Jpdl3ConverterReaderTest.java
===================================================================
---
jbpm4/trunk/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/Jpdl3ConverterReaderTest.java 2009-07-17
15:02:57 UTC (rev 5326)
+++
jbpm4/trunk/modules/migration/src/test/java/org/jbpm/jpdl/internal/convert/Jpdl3ConverterReaderTest.java 2009-07-21
05:08:11 UTC (rev 5327)
@@ -25,6 +25,7 @@
import java.util.List;
import org.dom4j.Document;
+import org.dom4j.Element;
import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
import org.jbpm.pvm.internal.env.EnvironmentFactory;
@@ -67,7 +68,12 @@
@Test
public void testProcessState() throws Exception {
- testConvert("process-state.xml");
+ Document convertedDoc = convert("process-state.xml");
+ Element ele = convertedDoc.getRootElement();
+ String subProcessKey =
ele.element("sub-process").attributeValue("sub-process-key");
+ Assert.assertEquals("interview", subProcessKey);
+ validate(convertedDoc);
+
}
@Test
@@ -126,7 +132,7 @@
@Test
public void testTimer() throws Exception {
- String xml = convert("timer.xml");
+ String xml = convert("timer.xml").asXML();
List<Problem> problems = new JpdlParser().createParse().setString(xml)
.execute().getProblems();
Assert.assertEquals(2, problems.size());
@@ -139,7 +145,7 @@
@Test
public void testMailNode() throws Exception {
setUpEnviroment();
- String xml = convert("mail-node.xml");
+ String xml = convert("mail-node.xml").asXML();
List<Problem> problems = new JpdlParser().createParse().setString(xml)
.execute().getProblems();
Assert.assertEquals(0, problems.size());
@@ -149,21 +155,26 @@
private void testConvert(String resourcefile) throws Exception {
- String xml = convert(resourcefile);
- List<Problem> problems = new
JpdlParser().createParse().setString(xml).execute().getProblems();
- Assert.assertEquals(problems.toString(), 0, problems.size());
+ Document doc = convert(resourcefile);
+ validate(doc);
}
-
- private String convert(String resouceFile) throws Exception {
+
+
+ private Document convert(String resouceFile) throws Exception {
InputStream inputStream =
getClass().getClassLoader().getResourceAsStream(resouceFile);
// Convert to process file to jpdl4
InputSource ins = new InputSource(inputStream);
Jpdl3Converter converter = new Jpdl3Converter(ins);
Document doc = converter.readAndConvert();
//System.out.println(doc.asXML());
- return doc.asXML();
+ return doc;
}
-
+
+ private void validate(Document convertedDoc) throws Exception {
+ List<Problem> problems = new
JpdlParser().createParse().setString(convertedDoc.asXML()).execute().getProblems();
+ Assert.assertEquals(problems.toString(), 0, problems.size());
+ }
+
private void setUpEnviroment() throws Exception {
EnvironmentFactory environmentFactory = JbpmConfiguration
.parseXmlString("<jbpm-configuration>"
Show replies by date