[JBoss jBPM] - Re: required variables
by dleerob
I have created a TestCase to show the problem. It completes through to the end. Please let me know if you manage to find a solution/fix.
/**
| * [JBPM 3.2.1]
| * This TestCase should show that the when a variable it set to required,
| * the taskInstance is still able to complete, even when said variable is null.
| * Calling taskInstance.end() does not throw an exception.
| *
| * @author dleerob
| *
| */
| public class ProcessTest extends TestCase {
|
| public void testProcess() throws Exception {
|
| ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
| "<process-definition name='simple'>" +
| " <start-state name='start'>" +
| " <task name='Request For New Employee'>"+
| " <controller>"+
| " <variable name='IsReplacement' access='read,write,required'></variable>"+
| " </controller>"+
| " </task>"+
| " <transition name='' to='Financial Director Approval 1' />" +
| " </start-state>" +
| " <task-node name='Financial Director Approval 1'>" +
| " <task name='Financial Director Approval 1'>"+
| " <controller>"+
| " <variable name='Approved' access='read,write,required'></variable>"+
| " </controller>"+
| " </task>"+
| " <transition name='' to='end' />" +
| " </task-node>" +
| " <end-state name='end' />" +
| "</process-definition>"
| );
|
| assertNotNull("Definition should not be null", processDefinition);
|
| //create an instance of the process definition.
| ProcessInstance instance = new ProcessInstance(processDefinition);
|
| //create start task instance.
| TaskMgmtInstance taskMgmtInstance = instance.getTaskMgmtInstance();
| TaskInstance startTaskInstance = taskMgmtInstance.createStartTaskInstance();
|
| assertNotNull("Start Task Instance should not be null", startTaskInstance);
| assertEquals("Request For New Employee", startTaskInstance.getName());
|
| Token token = instance.getRootToken();
| assertSame(processDefinition.getNode("start"), token.getNode());
|
| //make sure our IsReplacement variable is null.
| assertNull("IsReplacement variable is null",startTaskInstance.getVariable("IsReplacement"));
|
| //ending the startTaskInstance should throw an exception if IsReplacement variable
| //is null, as the variable is set to "required" in the process definition above,
| //but it doesn't seem to throw the exception.
| startTaskInstance.end();
|
| //this should never of happened.
| assertNull("IsReplacement variable is still null",startTaskInstance.getVariable("IsReplacement"));
|
|
| //I also want to test if the next task node isn't working properly
| //when saving required variables with a null value.
| //This way we rule out the possiblity that there is only
| //an error with the Start Task Instance.
| assertSame(processDefinition.getNode("Financial Director Approval 1"), token.getNode());
|
| TaskInstance financeDirectorApproval1TaskInstance = null;
| for(Iterator it = taskMgmtInstance.getTaskInstances().iterator();it.hasNext();) {
| TaskInstance taskInstance = (TaskInstance)it.next();
| if (taskInstance.getName().equals("Financial Director Approval 1")) {
| financeDirectorApproval1TaskInstance = taskInstance;
| break;
| }
| }
|
| assertNotNull("Finance Director Approval Task Instance is not null", financeDirectorApproval1TaskInstance);
| assertEquals(financeDirectorApproval1TaskInstance.getName(),"Financial Director Approval 1");
|
| //make sure our Approved variable is null.
| assertNull("Approved variable is null",financeDirectorApproval1TaskInstance.getVariable("Approved"));
|
| //ending the financeDirectorApproval1TaskInstance should throw an exception if
| //Approved variable is null, as the variable is set to "required" in the process definition above,
| //but it doesn't seem to throw the exception.
| financeDirectorApproval1TaskInstance.end();
|
| //this should never of happened.
| assertNull("Approved variable is still null",startTaskInstance.getVariable("Approved"));
|
| assertSame(processDefinition.getNode("end"), token.getNode());
|
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4083972#4083972
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4083972
18 years, 9 months
[EJB 3.0] - Re: Issues with EJB 3.0/ JBoss 4.0.5
by avthosar
This is the output on the server end. Only 1 instance of GUID here as well.
org.jboss.util.id.GUID Information
Repository cache version:
org.jboss.util.id.GUID(3f96ee).ClassLoader=org.jboss.system.server.NoAnnotationURLClassLoader@cdedfd
..org.jboss.system.server.NoAnnotationURLClassLoader@cdedfd
..sun.misc.Launcher$AppClassLoader@fabe9
....file:/C:/Program%20Files/Java/jdk1.6.0_01/lib/tools.jar
....file:/E:/jboss-3.2.8.SP1/bin/run.jar
..sun.misc.Launcher$ExtClassLoader@df6ccd
....file:/C:/Program%20Files/Java/jdk1.6.0_01/jre/lib/ext/dnsns.jar
....file:/C:/Program%20Files/Java/jdk1.6.0_01/jre/lib/ext/localedata.jar
....file:/C:/Program%20Files/Java/jdk1.6.0_01/jre/lib/ext/sunjce_provider.jar
....file:/C:/Program%20Files/Java/jdk1.6.0_01/jre/lib/ext/sunmscapi.jar
....file:/C:/Program%20Files/Java/jdk1.6.0_01/jre/lib/ext/sunpkcs11.jar
++++CodeSource: (file:/E:/jboss-3.2.8.SP1/lib/jboss-common.jar )
Implemented Interfaces:
++interface org.jboss.util.id.ID(394576)
++++ClassLoader: org.jboss.system.server.NoAnnotationURLClassLoader@cdedfd
++++CodeSource: (file:/E:/jboss-3.2.8.SP1/lib/jboss-common.jar )
++interface java.lang.Comparable(1ff5160)
++++ClassLoader: null
++++Null CodeSource
### Instance0 via UCL: org.jboss.system.server.NoAnnotationURLClassLoader@cdedfd
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4083971#4083971
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4083971
18 years, 9 months