Search in sources :

Example 1 with Automatic

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

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

the class PvmActivityInstanceCompleteTest method testSimpleSubProcess.

/**
 *           +-------------------------------+
 *           | embeddedsubprocess            |
 *           |                               |
 * +-----+   |  +-----------+   +---------+  |   +---+
 * |start|-->|  |startInside|-->|endInside|  |-->|end|
 * +-----+   |  +-----------+   +---------+  |   +---+
 *           |                               |
 *           |                               |
 *           +-------------------------------+
 */
public void testSimpleSubProcess() {
    ActivityInstanceVerification verifier = new ActivityInstanceVerification();
    PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("embeddedsubprocess").endActivity().createActivity("embeddedsubprocess").scope().behavior(new EmbeddedSubProcess()).executionListener(ExecutionListener.EVENTNAME_END, verifier).createActivity("startInside").behavior(new Automatic()).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("endInside").endActivity().createActivity("endInside").behavior(new End()).executionListener(ExecutionListener.EVENTNAME_END, verifier).endActivity().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("embeddedsubprocess", 1);
    verifier.assertNonCompletingActivityInstance("startInside", 1);
    verifier.assertIsCompletingActivityInstance("endInside", 1);
    verifier.assertIsCompletingActivityInstance("end", 1);
}
Also used : EmbeddedSubProcess(org.camunda.bpm.engine.test.standalone.pvm.activities.EmbeddedSubProcess) 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 3 with Automatic

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

the class PvmActivityInstanceCompleteTest method testBoundaryEvent.

/**
 *           +----------+
 *           | userTask |
 *           |          |
 * +-----+   |          |    +------+
 * |start|-->|          |--->| end1 |
 * +-----+   | +-----+  |
 *           +-|timer|--+
 *             +-----+
 *                |          +------+
 *                +--------->| end2 |
 *                           +------+
 */
public void testBoundaryEvent() {
    ActivityInstanceVerification verifier = new ActivityInstanceVerification();
    PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("userTask").endActivity().createActivity("userTask").scope().behavior(new EmbeddedSubProcess()).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("end1").endActivity().createActivity("timer").behavior(new WaitState()).executionListener(ExecutionListener.EVENTNAME_END, verifier).attachedTo("userTask", true).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();
    PvmExecution userTaskExecution = processInstance.findExecution("userTask");
    ((PvmExecutionImpl) userTaskExecution).executeActivity(processDefinition.findActivity("timer"));
    PvmExecution timerExecution = processInstance.findExecution("timer");
    timerExecution.signal(null, null);
    verifier.assertNonCompletingActivityInstance("start", 1);
    verifier.assertNonCompletingActivityInstance("userTask", 1);
    verifier.assertIsCompletingActivityInstance("end2", 1);
}
Also used : EmbeddedSubProcess(org.camunda.bpm.engine.test.standalone.pvm.activities.EmbeddedSubProcess) WaitState(org.camunda.bpm.engine.test.standalone.pvm.activities.WaitState) PvmProcessInstance(org.camunda.bpm.engine.impl.pvm.PvmProcessInstance) PvmExecutionImpl(org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl) 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)

Example 4 with Automatic

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

the class PvmBasicLinearExecutionTest method testStartEnd.

/**
 * +-------+   +-----+
 * | start |-->| end |
 * +-------+   +-----+
 */
public void testStartEnd() {
    PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).transition("end").endActivity().createActivity("end").behavior(new End()).endActivity().buildProcessDefinition();
    PvmProcessInstance processInstance = processDefinition.createProcessInstance();
    processInstance.start();
    assertEquals(new ArrayList<String>(), processInstance.findActiveActivityIds());
    assertTrue(processInstance.isEnded());
}
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 5 with Automatic

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

the class PvmBasicLinearExecutionTest method testSingleAutomatic.

/**
 * +-----+   +-----+   +-------+
 * | one |-->| two |-->| three |
 * +-----+   +-----+   +-------+
 */
public void testSingleAutomatic() {
    PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("one").initial().behavior(new Automatic()).transition("two").endActivity().createActivity("two").behavior(new Automatic()).transition("three").endActivity().createActivity("three").behavior(new End()).endActivity().buildProcessDefinition();
    PvmProcessInstance processInstance = processDefinition.createProcessInstance();
    processInstance.start();
    assertEquals(new ArrayList<String>(), processInstance.findActiveActivityIds());
    assertTrue(processInstance.isEnded());
}
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)

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