use of org.camunda.bpm.engine.test.standalone.pvm.activities.ParallelGateway in project camunda-bpm-platform by camunda.
the class PvmActivityInstanceCompleteTest method testSingleEndAfterParallelJoin.
/**
* +----+
* +--->| a1 |---+
* | +----+ |
* | v
* +-----+ +----+ +------+ +-----+
* |start|-->|fork| | join |--->| end |
* +-----+ +----+ +------+ +-----+
* | ^
* | +----+ |
* +--->| a2 |---+
* +----+
*/
public void testSingleEndAfterParallelJoin() {
ActivityInstanceVerification verifier = new ActivityInstanceVerification();
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("fork").endActivity().createActivity("fork").behavior(new ParallelGateway()).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("a1").transition("a2").endActivity().createActivity("a1").behavior(new Automatic()).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("join").endActivity().createActivity("a2").behavior(new Automatic()).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("join").endActivity().createActivity("join").behavior(new ParallelGateway()).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("end").endActivity().createActivity("end").behavior(new End()).executionListener(ExecutionListener.EVENTNAME_END, verifier).endActivity().buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
verifier.assertNonCompletingActivityInstance("start", 1);
verifier.assertNonCompletingActivityInstance("fork", 1);
verifier.assertNonCompletingActivityInstance("a1", 1);
verifier.assertNonCompletingActivityInstance("a2", 1);
verifier.assertNonCompletingActivityInstance("join", 2);
verifier.assertIsCompletingActivityInstance("end", 1);
}
use of org.camunda.bpm.engine.test.standalone.pvm.activities.ParallelGateway in project camunda-bpm-platform by camunda.
the class PvmParallelTest method testUnstructuredConcurrencyTwoJoins.
public void testUnstructuredConcurrencyTwoJoins() {
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).transition("fork").endActivity().createActivity("fork").behavior(new ParallelGateway()).transition("c1").transition("c2").transition("c3").endActivity().createActivity("c1").behavior(new Automatic()).transition("join1").endActivity().createActivity("c2").behavior(new Automatic()).transition("join1").endActivity().createActivity("c3").behavior(new Automatic()).transition("join2").endActivity().createActivity("join1").behavior(new ParallelGateway()).transition("c4").endActivity().createActivity("c4").behavior(new Automatic()).transition("join2").endActivity().createActivity("join2").behavior(new ParallelGateway()).transition("end").endActivity().createActivity("end").behavior(new WaitState()).endActivity().buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
assertNotNull(processInstance.findExecution("end"));
}
use of org.camunda.bpm.engine.test.standalone.pvm.activities.ParallelGateway in project camunda-bpm-platform by camunda.
the class PvmActivityInstanceCompleteTest method testTwoEnds.
/**
* +----+
* +--->|end1|
* | +----+
* |
* +-----+ +----+
* |start|-->|fork|
* +-----+ +----+
* |
* | +----+
* +--->|end2|
* +----+
*/
public void testTwoEnds() {
ActivityInstanceVerification verifier = new ActivityInstanceVerification();
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("fork").endActivity().createActivity("fork").behavior(new ParallelGateway()).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("end1").transition("end2").endActivity().createActivity("end1").behavior(new End()).executionListener(ExecutionListener.EVENTNAME_END, verifier).endActivity().createActivity("end2").behavior(new End()).executionListener(ExecutionListener.EVENTNAME_END, verifier).endActivity().buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
verifier.assertNonCompletingActivityInstance("start", 1);
verifier.assertNonCompletingActivityInstance("fork", 1);
verifier.assertIsCompletingActivityInstance("end1", 1);
verifier.assertIsCompletingActivityInstance("end2", 1);
}
use of org.camunda.bpm.engine.test.standalone.pvm.activities.ParallelGateway in project camunda-bpm-platform by camunda.
the class PvmParallelEndTest method testParallelEnd.
/**
* +----+
* +--->|end1|
* | +----+
* |
* +-----+ +----+
* |start|-->|fork|
* +-----+ +----+
* |
* | +----+
* +--->|end2|
* +----+
*/
public void testParallelEnd() {
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).transition("fork").endActivity().createActivity("fork").behavior(new ParallelGateway()).transition("end1").transition("end2").endActivity().createActivity("end1").behavior(new End()).endActivity().createActivity("end2").behavior(new End()).endActivity().buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
assertTrue(processInstance.isEnded());
}
use of org.camunda.bpm.engine.test.standalone.pvm.activities.ParallelGateway in project camunda-bpm-platform by camunda.
the class PvmActivityInstanceTest method testMultipleConcurrentEndsInsideEmbeddedSubProcessWithWaitState.
/**
* +-------------------------------------------------+
* | embeddedsubprocess +----------+ |
* | +---->|endInside1| |
* | | +----------+ |
* | | |
* +-----+ | +-----------+ +----+ +----+ +----------+ | +---+
* |start|-->| |startInside|-->|fork|-->|wait|-->|endInside2| |-->|end|
* +-----+ | +-----------+ +----+ +----+ +----------+ | +---+
* | | |
* | | +----------+ |
* | +---->|endInside3| |
* | +----------+ |
* +-------------------------------------------------+
*/
public void testMultipleConcurrentEndsInsideEmbeddedSubProcessWithWaitState() {
ActivityInstanceVerification verifier = new ActivityInstanceVerification();
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("embeddedsubprocess").endActivity().createActivity("embeddedsubprocess").scope().behavior(new EmbeddedSubProcess()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).createActivity("startInside").behavior(new Automatic()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("fork").endActivity().createActivity("fork").behavior(new ParallelGateway()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("endInside1").transition("wait").transition("endInside3").endActivity().createActivity("endInside1").behavior(new End()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).endActivity().createActivity("wait").behavior(new WaitState()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("endInside2").endActivity().createActivity("endInside2").behavior(new End()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).endActivity().createActivity("endInside3").behavior(new End()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).endActivity().transition("end").endActivity().createActivity("end").behavior(new End()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).endActivity().buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
assertFalse(processInstance.isEnded());
PvmExecution execution = processInstance.findExecution("wait");
execution.signal(null, null);
assertTrue(processInstance.isEnded());
verifier.assertStartInstanceCount(1, "start");
verifier.assertProcessInstanceParent("start", processInstance);
verifier.assertStartInstanceCount(1, "embeddedsubprocess");
verifier.assertProcessInstanceParent("embeddedsubprocess", processInstance);
verifier.assertStartInstanceCount(1, "startInside");
verifier.assertParent("startInside", "embeddedsubprocess");
verifier.assertStartInstanceCount(1, "fork");
verifier.assertParent("fork", "embeddedsubprocess");
verifier.assertStartInstanceCount(1, "wait");
verifier.assertParent("wait", "embeddedsubprocess");
verifier.assertStartInstanceCount(1, "endInside1");
verifier.assertParent("endInside1", "embeddedsubprocess");
verifier.assertStartInstanceCount(1, "endInside2");
verifier.assertParent("endInside2", "embeddedsubprocess");
verifier.assertStartInstanceCount(1, "endInside3");
verifier.assertParent("endInside3", "embeddedsubprocess");
verifier.assertStartInstanceCount(1, "end");
verifier.assertProcessInstanceParent("end", processInstance);
}
Aggregations