Created
January 8, 2011 14:26
-
-
Save nurkiewicz/770878 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final Execution forkB = runtimeService.createExecutionQuery() | |
.activityId("Task_B") | |
.processInstanceId(pid) | |
.singleResult(); | |
log.debug("Found forked execution {} in Task B activity for process {}", forkB, pid); | |
runtimeService.signal(forkB.getId()); | |
log.debug("Advanced fork B, waiting in concurrent activities B1 and B2"); | |
assertThat(runtimeService.getActiveActivityIds(pid)).containsOnly("Task_B1", "Task_B2"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final Execution forkB1 = runtimeService | |
.createExecutionQuery() | |
.processInstanceId(pid) | |
.activityId("Task_B1") | |
.singleResult(); | |
assertThat(forkB1).isNotNull(); | |
assertThat(runtimeService.getActiveActivityIds(forkB1.getId())).containsOnly("Task_B1"); | |
final Execution forkB2 = runtimeService | |
.createExecutionQuery() | |
.processInstanceId(pid) | |
.activityId("Task_B2") | |
.singleResult(); | |
assertThat(forkB2).isNotNull(); | |
assertThat(runtimeService.getActiveActivityIds(forkB2.getId())).containsOnly("Task_B2"); | |
log.debug("Found forked executions {} and {} in B1/B2 activities accordingly ", forkB1, forkB2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
runtimeService.signal(forkB1.getId()); | |
assertThat(runtimeService.getActiveActivityIds(forkB1.getId())).isEmpty(); | |
assertThat(runtimeService.getActiveActivityIds(forkB2.getId())).containsExactly("Task_B2"); | |
assertThat(runtimeService.getActiveActivityIds(forkA.getId())).isEmpty(); | |
log.debug("Signalling fork B2 will activate Join AB"); | |
runtimeService.signal(forkB2.getId()); | |
assertThat( | |
runtimeService | |
.createExecutionQuery() | |
.executionId(forkA.getId()) | |
.singleResult() | |
).isNull(); | |
assertThat( | |
runtimeService | |
.createExecutionQuery() | |
.executionId(forkB1.getId()) | |
.singleResult() | |
).isNull(); | |
assertThat( | |
runtimeService | |
.createExecutionQuery() | |
.executionId(forkB2.getId()) | |
.singleResult() | |
).isNull(); | |
assertThat(runtimeService.getActiveActivityIds(pid)).containsOnly("Task_C"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
assertThat( | |
runtimeService | |
.createExecutionQuery() | |
.processInstanceId(pid) | |
.list() | |
).hasSize(1); | |
log.debug("Signalling Task C to finish the process"); | |
runtimeService.signal(pid); | |
assertThat( | |
runtimeService | |
.createProcessInstanceQuery() | |
.processInstanceId(pid) | |
.singleResult() | |
).isNull(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Found forked executions ConcurrentExecution[30328948] and ConcurrentExecution[17972912] in B1/B2 activities accordingly | |
Leaving activity 'Task_B1' | |
ConcurrentExecution[13137441] takes transition (Task_B1)--Flow_11-->(Join_AB) | |
ConcurrentExecution[13137441] executes Activity(Join_AB): org.activiti.engine.impl.bpmn.ParallelGatewayActivity | |
parallel gateway 'Join_AB' does not activate: 2 of 3 joined | |
Signalling fork B2 will activate Join AB | |
Leaving activity 'Task_B2' | |
ConcurrentExecution[12112029] takes transition (Task_B2)--Flow_10-->(Join_AB) | |
ConcurrentExecution[12112029] executes Activity(Join_AB): org.activiti.engine.impl.bpmn.ParallelGatewayActivity | |
parallel gateway 'Join_AB' activates: 3 of 3 joined | |
ProcessInstance[5686223] takes transition (Join_AB)--Flow_8-->(Task_C) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment