Search in sources :

Example 11 with ParallelGateway

use of org.camunda.bpm.engine.test.standalone.pvm.activities.ParallelGateway in project camunda-bpm-platform by camunda.

the class PvmParallelTest method testSimpleWaitStateConcurrency.

public void testSimpleWaitStateConcurrency() {
    PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).transition("fork").endActivity().createActivity("fork").behavior(new ParallelGateway()).transition("c1").transition("c2").endActivity().createActivity("c1").behavior(new WaitState()).transition("join").endActivity().createActivity("c2").behavior(new WaitState()).transition("join").endActivity().createActivity("join").behavior(new ParallelGateway()).transition("end").endActivity().createActivity("end").behavior(new WaitState()).endActivity().buildProcessDefinition();
    PvmProcessInstance processInstance = processDefinition.createProcessInstance();
    processInstance.start();
    PvmExecution activityInstanceC1 = processInstance.findExecution("c1");
    assertNotNull(activityInstanceC1);
    PvmExecution activityInstanceC2 = processInstance.findExecution("c2");
    assertNotNull(activityInstanceC2);
    activityInstanceC1.signal(null, null);
    activityInstanceC2.signal(null, null);
    List<String> activityNames = processInstance.findActiveActivityIds();
    List<String> expectedActivityNames = new ArrayList<String>();
    expectedActivityNames.add("end");
    assertEquals(expectedActivityNames, activityNames);
}
Also used : WaitState(org.camunda.bpm.engine.test.standalone.pvm.activities.WaitState) PvmProcessInstance(org.camunda.bpm.engine.impl.pvm.PvmProcessInstance) ParallelGateway(org.camunda.bpm.engine.test.standalone.pvm.activities.ParallelGateway) ArrayList(java.util.ArrayList) PvmProcessDefinition(org.camunda.bpm.engine.impl.pvm.PvmProcessDefinition) ProcessDefinitionBuilder(org.camunda.bpm.engine.impl.pvm.ProcessDefinitionBuilder) Automatic(org.camunda.bpm.engine.test.standalone.pvm.activities.Automatic) PvmExecution(org.camunda.bpm.engine.impl.pvm.PvmExecution)

Example 12 with ParallelGateway

use of org.camunda.bpm.engine.test.standalone.pvm.activities.ParallelGateway in project camunda-bpm-platform by camunda.

the class PvmParallelTest method testJoinForkCombinedInOneParallelGateway.

public void testJoinForkCombinedInOneParallelGateway() {
    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").transition("c5").transition("c6").endActivity().createActivity("c4").behavior(new Automatic()).transition("join2").endActivity().createActivity("c5").behavior(new Automatic()).transition("join2").endActivity().createActivity("c6").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"));
}
Also used : WaitState(org.camunda.bpm.engine.test.standalone.pvm.activities.WaitState) PvmProcessInstance(org.camunda.bpm.engine.impl.pvm.PvmProcessInstance) ParallelGateway(org.camunda.bpm.engine.test.standalone.pvm.activities.ParallelGateway) PvmProcessDefinition(org.camunda.bpm.engine.impl.pvm.PvmProcessDefinition) ProcessDefinitionBuilder(org.camunda.bpm.engine.impl.pvm.ProcessDefinitionBuilder) Automatic(org.camunda.bpm.engine.test.standalone.pvm.activities.Automatic)

Aggregations

ProcessDefinitionBuilder (org.camunda.bpm.engine.impl.pvm.ProcessDefinitionBuilder)12 PvmProcessDefinition (org.camunda.bpm.engine.impl.pvm.PvmProcessDefinition)12 PvmProcessInstance (org.camunda.bpm.engine.impl.pvm.PvmProcessInstance)12 Automatic (org.camunda.bpm.engine.test.standalone.pvm.activities.Automatic)12 ParallelGateway (org.camunda.bpm.engine.test.standalone.pvm.activities.ParallelGateway)12 End (org.camunda.bpm.engine.test.standalone.pvm.activities.End)8 WaitState (org.camunda.bpm.engine.test.standalone.pvm.activities.WaitState)6 PvmExecution (org.camunda.bpm.engine.impl.pvm.PvmExecution)3 EmbeddedSubProcess (org.camunda.bpm.engine.test.standalone.pvm.activities.EmbeddedSubProcess)3 ArrayList (java.util.ArrayList)2