[jboss-svn-commits] JBL Code SVN: r17346 - in labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/jbpm/src/test: resources and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Dec 20 14:32:10 EST 2007
Author: kurt.stam at jboss.com
Date: 2007-12-20 14:32:09 -0500 (Thu, 20 Dec 2007)
New Revision: 17346
Added:
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/jbpm/src/test/resources/testExceptionHandling.jpg
Modified:
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/ExceptionFlowTest.java
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/jbpm/src/test/resources/testExceptionHandling.xml
Log:
JBESB-1301 Adding tests for conditional exception handling.
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/ExceptionFlowTest.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/ExceptionFlowTest.java 2007-12-20 19:04:00 UTC (rev 17345)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actionhandlers/ExceptionFlowTest.java 2007-12-20 19:32:09 UTC (rev 17346)
@@ -121,6 +121,10 @@
assertEquals("ExceptionHandling",token.getNode().getName());
}
+ /**
+ * Tests bypassing the timout and taking the exception transition on service2.
+ *
+ */
@Test
public void takeExceptionTransition() {
JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
@@ -140,6 +144,89 @@
assertEquals("ExceptionHandling",token.getNode().getName());
}
+ /**
+ * Tests bypassing the timout and setting exception of 3 to take the conditional transition.
+ *
+ */
+ @Test
+ public void takeConditionalTransition() {
+ JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
+ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+ ProcessInstance processInstance = jbpmContext.loadProcessInstance(processInstanceId);
+
+ Token token = processInstance.getRootToken();
+ assertEquals("start",token.getNode().getName());
+ //Move the process to service1
+ processInstance.signal();
+ assertEquals("Service1",token.getNode().getName());
+// Move the process to service2, no timeout on service1
+ processInstance.signal();
+ assertEquals("Service2",token.getNode().getName());
+ //Move the service3
+ processInstance.signal();
+ assertEquals("Service3",token.getNode().getName());
+ processInstance.getContextInstance().createVariable("exceptionCode",3);
+ processInstance.signal();
+ //Based on the setting of exceptionCode of 3 the conditional transition
+ //should be taken.
+ assertEquals("ExceptionHandling",token.getNode().getName());
+ }
+
+ /**
+ * Tests bypassing the timout and setting exception of 3 to take the conditional transition.
+ *
+ */
+ @Test
+ public void doNotTakeConditionalTransition() {
+ JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
+ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+ ProcessInstance processInstance = jbpmContext.loadProcessInstance(processInstanceId);
+
+ Token token = processInstance.getRootToken();
+ assertEquals("start",token.getNode().getName());
+ //Move the process to service1
+ processInstance.signal();
+ assertEquals("Service1",token.getNode().getName());
+// Move the process to service2, no timeout on service1
+ processInstance.signal();
+ assertEquals("Service2",token.getNode().getName());
+ //Move the service3
+ processInstance.signal();
+ assertEquals("Service3",token.getNode().getName());
+ processInstance.getContextInstance().createVariable("exceptionCode",2);
+ processInstance.signal();
+ //Based on the setting of exceptionCode of 2 the conditional transition
+ //should not be taken.
+ assertEquals("end",token.getNode().getName());
+ }
+
+ /**
+ * Tests bypassing the timout and setting exception of 3 to take the conditional transition.
+ *
+ */
+ @Test
+ public void doNotTakeConditionalTransition2() {
+ JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
+ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+ ProcessInstance processInstance = jbpmContext.loadProcessInstance(processInstanceId);
+
+ Token token = processInstance.getRootToken();
+ assertEquals("start",token.getNode().getName());
+ //Move the process to service1
+ processInstance.signal();
+ assertEquals("Service1",token.getNode().getName());
+// Move the process to service2, no timeout on service1
+ processInstance.signal();
+ assertEquals("Service2",token.getNode().getName());
+ //Move the service3
+ processInstance.signal();
+ assertEquals("Service3",token.getNode().getName());
+ processInstance.signal();
+ //Based on the not setting of exceptionCode the conditional transition
+ //should not be taken.
+ assertEquals("end",token.getNode().getName());
+ }
+
public static junit.framework.Test suite(){
return new JUnit4TestAdapter(ExceptionFlowTest.class);
}
Added: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/jbpm/src/test/resources/testExceptionHandling.jpg
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/jbpm/src/test/resources/testExceptionHandling.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/jbpm/src/test/resources/testExceptionHandling.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/jbpm/src/test/resources/testExceptionHandling.xml 2007-12-20 19:04:00 UTC (rev 17345)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/jbpm/src/test/resources/testExceptionHandling.xml 2007-12-20 19:32:09 UTC (rev 17346)
@@ -4,7 +4,7 @@
xmlns="urn:jbpm.org:jpdl-3.2"
name="testExceptionHandling">
<start-state name="start">
- <transition name="" to="Service1"></transition>
+ <transition name="ok" to="Service1"></transition>
</start-state>
<node name="Service1">
<action class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
@@ -12,7 +12,7 @@
<esbServiceName>MockService</esbServiceName>
</action>
<timer name='timeout' duedate='1 seconds' transition='time-out-transition'/>
- <transition name="" to="Service2"></transition>
+ <transition name="ok" to="Service2"></transition>
<transition name="time-out-transition" to="ExceptionHandling"></transition>
</node>
<node name="Service2">
@@ -20,7 +20,7 @@
<esbCategoryName>MockCategory</esbCategoryName>
<esbServiceName>MockService</esbServiceName>
</action>
- <transition name="" to="Service3"></transition>
+ <transition name="ok" to="Service3"></transition>
<transition name="exception" to="ExceptionHandling"></transition>
</node>
<end-state name="ExceptionHandling"></end-state>
@@ -29,8 +29,14 @@
<esbCategoryName>MockCategory</esbCategoryName>
<esbServiceName>MockService</esbServiceName>
</action>
- <transition name="" to="end"></transition>
- <transition name="exception" to="ExceptionHandling"></transition>
+ <transition name="ok" to="exceptionDecision"></transition>
+
</node>
<end-state name="end"></end-state>
+ <decision name="exceptionDecision">
+ <transition name="ok" to="end"></transition>
+ <transition name="exceptionCondition" to="ExceptionHandling">
+ <condition>#{ exceptionCode==3}</condition>
+ </transition>
+ </decision>
</process-definition>
\ No newline at end of file
More information about the jboss-svn-commits
mailing list