06-28-2012 09:39 AM
06-28-2012 10:40 AM
/**
* Called when the wrapped {@link ActivityBehavior} calls the
* {@link AbstractBpmnActivityBehavior#leave(ActivityExecution)} method.
* Handles the completion of one instance, and executes the logic for the sequential behavior.
*/
public void leave(ActivityExecution execution) {
callActivityEndListeners(execution);
06-28-2012 11:01 AM
06-29-2012 01:52 AM
@Deployment(resources = {"org/activiti/engine/test/bpmn/multiinstance/MultiInstanceTest.sequentialServiceTasksWithListeners.bpmn20.xml"})
public void testSequentialServiceTasksWithListeners() {
HashMap<String, Object> variables = new HashMap<String, Object>();
variables.put("nrOfLoops", 3);
variables.put("startCount", 0L);
variables.put("runCount", 0L);
variables.put("endCount", 0L);
// Start process
String procId = runtimeService.startProcessInstanceByKey("miSequentialServiceTasks", variables).getId();
Map<String, Object> variablesAfterRun = runtimeService.getVariables(procId);
assertEquals(3L, variablesAfterRun.get("startCount"));
assertEquals(3L, variablesAfterRun.get("runCount"));
assertEquals(3L, variablesAfterRun.get("endCount"));
}
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definition"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:activiti="http://activiti.org/bpmn"
targetNamespace="Examples">
<process id="miSequentialServiceTasks">
<startEvent id="theStart" />
<sequenceFlow id="flow1" sourceRef="theStart" targetRef="serviceTask" />
<serviceTask id="serviceTask" name="Do stuff" activiti:expression="${execution.setVariable('runCount', execution.getVariable('runCount') + 1)}">
<extensionElements>
<activiti:executionListener expression="${execution.setVariable('endCount', execution.getVariable('endCount') + 1)}" event="end" />
<activiti:executionListener expression="${execution.setVariable('startCount', execution.getVariable('startCount') + 1)}" event="start" />
</extensionElements>
<multiInstanceLoopCharacteristics isSequential="true">
<loopCardinality>${nrOfLoops}</loopCardinality>
<completionCondition>${nrOfCompletedInstances == 3}</completionCondition>
</multiInstanceLoopCharacteristics>
</serviceTask>
<sequenceFlow id="flow3" sourceRef="serviceTask" targetRef="userTask" />
<userTask id="userTask" />
<sequenceFlow id="flow4" sourceRef="userTask" targetRef="theEnd" />
<endEvent id="theEnd" />
</process>
</definitions>
junit.framework.AssertionFailedError: expected:<3> but was:<4>
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.Assert.failNotEquals(Assert.java:283)
at junit.framework.Assert.assertEquals(Assert.java:64)
at junit.framework.Assert.assertEquals(Assert.java:71)
at org.activiti.engine.test.bpmn.multiinstance.MultiInstanceTest.testSequentialServiceTasksWithListeners(MultiInstanceTest.java:82)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:168)
at org.activiti.engine.impl.test.PvmTestCase.runTest(PvmTestCase.java:75)
at junit.framework.TestCase.runBare(TestCase.java:134)
at org.activiti.engine.impl.test.AbstractActivitiTestCase.runBare(AbstractActivitiTestCase.java:90)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
06-29-2012 11:12 AM
07-02-2012 08:33 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.