Search in sources :

Example 16 with Automatic

use of org.camunda.bpm.engine.test.standalone.pvm.activities.Automatic 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"));
}
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)

Example 17 with Automatic

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

the class PvmTest method testPvmDecision.

public void testPvmDecision() {
    PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).transition("checkCredit").endActivity().createActivity("checkCredit").behavior(new Decision()).transition("askDaughterOut", "wow").transition("takeToGolf", "nice").transition("ignore", "default").endActivity().createActivity("takeToGolf").behavior(new WaitState()).endActivity().createActivity("askDaughterOut").behavior(new WaitState()).endActivity().createActivity("ignore").behavior(new WaitState()).endActivity().buildProcessDefinition();
    PvmProcessInstance processInstance = processDefinition.createProcessInstance();
    processInstance.setVariable("creditRating", "Aaa-");
    processInstance.start();
    assertNotNull(processInstance.findExecution("takeToGolf"));
    processInstance = processDefinition.createProcessInstance();
    processInstance.setVariable("creditRating", "AAA+");
    processInstance.start();
    assertNotNull(processInstance.findExecution("askDaughterOut"));
    processInstance = processDefinition.createProcessInstance();
    processInstance.setVariable("creditRating", "bb-");
    processInstance.start();
    assertNotNull(processInstance.findExecution("ignore"));
}
Also used : WaitState(org.camunda.bpm.engine.test.standalone.pvm.activities.WaitState) PvmProcessInstance(org.camunda.bpm.engine.impl.pvm.PvmProcessInstance) PvmProcessDefinition(org.camunda.bpm.engine.impl.pvm.PvmProcessDefinition) ProcessDefinitionBuilder(org.camunda.bpm.engine.impl.pvm.ProcessDefinitionBuilder) Decision(org.camunda.bpm.engine.test.standalone.pvm.activities.Decision) Automatic(org.camunda.bpm.engine.test.standalone.pvm.activities.Automatic)

Example 18 with Automatic

use of org.camunda.bpm.engine.test.standalone.pvm.activities.Automatic 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);
}
Also used : 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) End(org.camunda.bpm.engine.test.standalone.pvm.activities.End) ProcessDefinitionBuilder(org.camunda.bpm.engine.impl.pvm.ProcessDefinitionBuilder) Automatic(org.camunda.bpm.engine.test.standalone.pvm.activities.Automatic)

Example 19 with Automatic

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

the class PvmActivityInstanceCompleteTest method testSingleEnd.

/**
 * +-------+   +-----+
 * | start |-->| end |
 * +-------+   +-----+
 */
public void testSingleEnd() {
    ActivityInstanceVerification verifier = new ActivityInstanceVerification();
    PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).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.assertIsCompletingActivityInstance("end", 1);
}
Also used : PvmProcessInstance(org.camunda.bpm.engine.impl.pvm.PvmProcessInstance) PvmProcessDefinition(org.camunda.bpm.engine.impl.pvm.PvmProcessDefinition) End(org.camunda.bpm.engine.test.standalone.pvm.activities.End) ProcessDefinitionBuilder(org.camunda.bpm.engine.impl.pvm.ProcessDefinitionBuilder) Automatic(org.camunda.bpm.engine.test.standalone.pvm.activities.Automatic)

Example 20 with Automatic

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

the class PvmBasicLinearExecutionTest method testCombinationOfWaitStatesAndAutomatics.

/**
 * +-----+   +-----+   +-------+   +------+    +------+
 * | one |-->| two |-->| three |-->| four |--> | five |
 * +-----+   +-----+   +-------+   +------+    +------+
 */
public void testCombinationOfWaitStatesAndAutomatics() {
    PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).transition("one").endActivity().createActivity("one").behavior(new WaitState()).transition("two").endActivity().createActivity("two").behavior(new WaitState()).transition("three").endActivity().createActivity("three").behavior(new Automatic()).transition("four").endActivity().createActivity("four").behavior(new Automatic()).transition("five").endActivity().createActivity("five").behavior(new End()).endActivity().buildProcessDefinition();
    PvmProcessInstance processInstance = processDefinition.createProcessInstance();
    processInstance.start();
    PvmExecution activityInstance = processInstance.findExecution("one");
    assertNotNull(activityInstance);
    activityInstance.signal(null, null);
    activityInstance = processInstance.findExecution("two");
    assertNotNull(activityInstance);
    activityInstance.signal(null, null);
    assertEquals(new ArrayList<String>(), processInstance.findActiveActivityIds());
    assertTrue(processInstance.isEnded());
}
Also used : WaitState(org.camunda.bpm.engine.test.standalone.pvm.activities.WaitState) PvmProcessInstance(org.camunda.bpm.engine.impl.pvm.PvmProcessInstance) PvmProcessDefinition(org.camunda.bpm.engine.impl.pvm.PvmProcessDefinition) End(org.camunda.bpm.engine.test.standalone.pvm.activities.End) 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)

Aggregations

ProcessDefinitionBuilder (org.camunda.bpm.engine.impl.pvm.ProcessDefinitionBuilder)43 PvmProcessDefinition (org.camunda.bpm.engine.impl.pvm.PvmProcessDefinition)43 PvmProcessInstance (org.camunda.bpm.engine.impl.pvm.PvmProcessInstance)43 Automatic (org.camunda.bpm.engine.test.standalone.pvm.activities.Automatic)43 End (org.camunda.bpm.engine.test.standalone.pvm.activities.End)30 WaitState (org.camunda.bpm.engine.test.standalone.pvm.activities.WaitState)20 EmbeddedSubProcess (org.camunda.bpm.engine.test.standalone.pvm.activities.EmbeddedSubProcess)18 ParallelGateway (org.camunda.bpm.engine.test.standalone.pvm.activities.ParallelGateway)12 ArrayList (java.util.ArrayList)9 PvmExecution (org.camunda.bpm.engine.impl.pvm.PvmExecution)9 ExecutionImpl (org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl)3 ProcessDefinitionImpl (org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl)2 PvmExecutionImpl (org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl)2 EventScopeCreatingSubprocess (org.camunda.bpm.engine.test.standalone.pvm.activities.EventScopeCreatingSubprocess)2 While (org.camunda.bpm.engine.test.standalone.pvm.activities.While)2 FoxDeleteProcessInstanceCmd (org.camunda.bpm.engine.impl.cmd.FoxDeleteProcessInstanceCmd)1 Decision (org.camunda.bpm.engine.test.standalone.pvm.activities.Decision)1 ReusableSubProcess (org.camunda.bpm.engine.test.standalone.pvm.activities.ReusableSubProcess)1 TransitionInstanceVerifyer (org.camunda.bpm.engine.test.standalone.pvm.verification.TransitionInstanceVerifyer)1