Search in sources :

Example 21 with PvmProcessInstance

use of org.camunda.bpm.engine.impl.pvm.PvmProcessInstance 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 22 with PvmProcessInstance

use of org.camunda.bpm.engine.impl.pvm.PvmProcessInstance in project camunda-bpm-platform by camunda.

the class PvmTest method testPvmWaitState.

public void testPvmWaitState() {
    PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("a").initial().behavior(new WaitState()).transition("b").endActivity().createActivity("b").behavior(new WaitState()).transition("c").endActivity().createActivity("c").behavior(new WaitState()).endActivity().buildProcessDefinition();
    PvmProcessInstance processInstance = processDefinition.createProcessInstance();
    processInstance.start();
    PvmExecution activityInstance = processInstance.findExecution("a");
    assertNotNull(activityInstance);
    activityInstance.signal(null, null);
    activityInstance = processInstance.findExecution("b");
    assertNotNull(activityInstance);
    activityInstance.signal(null, null);
    activityInstance = processInstance.findExecution("c");
    assertNotNull(activityInstance);
}
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) PvmExecution(org.camunda.bpm.engine.impl.pvm.PvmExecution)

Example 23 with PvmProcessInstance

use of org.camunda.bpm.engine.impl.pvm.PvmProcessInstance 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 24 with PvmProcessInstance

use of org.camunda.bpm.engine.impl.pvm.PvmProcessInstance 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 25 with PvmProcessInstance

use of org.camunda.bpm.engine.impl.pvm.PvmProcessInstance 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

PvmProcessInstance (org.camunda.bpm.engine.impl.pvm.PvmProcessInstance)50 ProcessDefinitionBuilder (org.camunda.bpm.engine.impl.pvm.ProcessDefinitionBuilder)45 PvmProcessDefinition (org.camunda.bpm.engine.impl.pvm.PvmProcessDefinition)45 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)22 EmbeddedSubProcess (org.camunda.bpm.engine.test.standalone.pvm.activities.EmbeddedSubProcess)18 ParallelGateway (org.camunda.bpm.engine.test.standalone.pvm.activities.ParallelGateway)12 PvmExecution (org.camunda.bpm.engine.impl.pvm.PvmExecution)11 ArrayList (java.util.ArrayList)9 ProcessDefinitionImpl (org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl)4 ExecutionImpl (org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl)3 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)2 ActivityImpl (org.camunda.bpm.engine.impl.pvm.process.ActivityImpl)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 HashMap (java.util.HashMap)1 FoxDeleteProcessInstanceCmd (org.camunda.bpm.engine.impl.cmd.FoxDeleteProcessInstanceCmd)1 DeploymentCache (org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)1