Author: jbarrez
Date: 2009-06-17 05:57:20 -0400 (Wed, 17 Jun 2009)
New Revision: 5050
Modified:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/StateTest.java
Log:
Added tests for JBPM-1214 : self-transition/loop back to State activity
Modified:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/StateTest.java
===================================================================
---
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/StateTest.java 2009-06-17
08:57:15 UTC (rev 5049)
+++
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/StateTest.java 2009-06-17
09:57:20 UTC (rev 5050)
@@ -149,4 +149,59 @@
ProcessInstance processInstance =
executionService.signalExecutionById("p.one");
assertTrue(processInstance.isActive("a"));
}
+
+ /**
+ * Test for JBPM-1214
+ *
+ * When a self transition comes back into the same state in the same transaction,
+ * potentially there could be optimistick locking failures.
+ */
+ public void testSelfTransition() {
+ deployJpdlXmlString(
+ "<process name='selfTransition'>" +
+ " <start>" +
+ " <transition to='wait' />" +
+ " </start>" +
+ " <state name='wait' >" +
+ " <transition to='wait' />" +
+ " </state>" +
+ "</process>"
+ );
+ ProcessInstance processInstance =
executionService.startProcessInstanceByKey("selfTransition");
+ assertTrue(processInstance.isActive("wait"));
+ executionService.signalExecutionById(processInstance.getId());
+ assertTrue(processInstance.isActive("wait"));
+ }
+
+ /**
+ * Test for JBPM-1214
+ *
+ * When a wait state is signalled and the execution comes back to the
+ * wait state, there can potentially be optimistic locking exceptions.
+ */
+ public void testLoopBackToSignalledState() {
+ deployJpdlXmlString(
+ "<process name='loopBackToState'>" +
+ " <start>" +
+ " <transition to='wait' />" +
+ " </start>" +
+ " <state name='wait' >" +
+ " <transition to='go further' />" +
+ " </state>" +
+ " <custom name='go further'
class='org.jbpm.test.activities.PassThroughActivity' >" +
+ " <transition to='go even further' />" +
+ " </custom>" +
+ " <custom name='go even further'
class='org.jbpm.test.activities.PassThroughActivity' >" +
+ " <transition to='wait' />" +
+ " </custom>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance =
executionService.startProcessInstanceByKey("loopBackToState");
+ assertTrue(processInstance.isActive("wait"));
+ executionService.signalExecutionById(processInstance.getId());
+ assertTrue(processInstance.isActive("wait"));
+ }
+
}
Show replies by date