Search in sources :

Example 11 with EmbeddedSubProcess

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

the class PvmActivityInstanceTest method testNestedSubProcessBothNoEnd.

/**
 *           +-------------------------------------------------------+
 *           | embedded subprocess                                   |
 *           |                  +--------------------------------+   |
 *           |                  | nested embedded subprocess     |   |
 * +-----+   | +-----------+    |  +-----------+                 |   |
 * |start|-->| |startInside|--> |  |startInside|                 |   |
 * +-----+   | +-----------+    |  +-----------+                 |   |
 *           |                  +--------------------------------+   |
 *           |                                                       |
 *           +-------------------------------------------------------+
 */
public void testNestedSubProcessBothNoEnd() {
    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("nestedSubProcess").endActivity().createActivity("nestedSubProcess").scope().behavior(new EmbeddedSubProcess()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).createActivity("startNestedInside").behavior(new Automatic()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).endActivity().endActivity().endActivity().buildProcessDefinition();
    PvmProcessInstance processInstance = processDefinition.createProcessInstance();
    processInstance.start();
    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, "nestedSubProcess");
    verifier.assertParent("nestedSubProcess", "embeddedsubprocess");
    verifier.assertStartInstanceCount(1, "startNestedInside");
    verifier.assertParent("startNestedInside", "nestedSubProcess");
}
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) ProcessDefinitionBuilder(org.camunda.bpm.engine.impl.pvm.ProcessDefinitionBuilder) Automatic(org.camunda.bpm.engine.test.standalone.pvm.activities.Automatic)

Example 12 with EmbeddedSubProcess

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

the class PvmEmbeddedSubProcessTest method testMultipleConcurrentEndsInsideEmbeddedSubProcessWithWaitState.

/**
 *           +-------------------------------------------------+
 *           | embeddedsubprocess        +----------+          |
 *           |                     +---->|endInside1|          |
 *           |                     |     +----------+          |
 *           |                     |                           |
 * +-----+   |  +-----------+   +----+   +----+   +----------+ |   +---+
 * |start|-->|  |startInside|-->|fork|-->|wait|-->|endInside2| |-->|end|
 * +-----+   |  +-----------+   +----+   +----+   +----------+ |   +---+
 *           |                     |                           |
 *           |                     |     +----------+          |
 *           |                     +---->|endInside3|          |
 *           |                           +----------+          |
 *           +-------------------------------------------------+
 */
public void testMultipleConcurrentEndsInsideEmbeddedSubProcessWithWaitState() {
    PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).transition("embeddedsubprocess").endActivity().createActivity("embeddedsubprocess").scope().behavior(new EmbeddedSubProcess()).createActivity("startInside").behavior(new Automatic()).transition("fork").endActivity().createActivity("fork").behavior(new ParallelGateway()).transition("endInside1").transition("wait").transition("endInside3").endActivity().createActivity("endInside1").behavior(new End()).endActivity().createActivity("wait").behavior(new WaitState()).transition("endInside2").endActivity().createActivity("endInside2").behavior(new End()).endActivity().createActivity("endInside3").behavior(new End()).endActivity().transition("end").endActivity().createActivity("end").behavior(new End()).endActivity().buildProcessDefinition();
    PvmProcessInstance processInstance = processDefinition.createProcessInstance();
    processInstance.start();
    assertFalse(processInstance.isEnded());
    PvmExecution execution = processInstance.findExecution("wait");
    execution.signal(null, null);
    assertTrue(processInstance.isEnded());
}
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) 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) PvmExecution(org.camunda.bpm.engine.impl.pvm.PvmExecution)

Example 13 with EmbeddedSubProcess

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

the class PvmEmbeddedSubProcessTest method testMultipleConcurrentEndsInsideEmbeddedSubProcess.

/**
 *           +----------------------------------------+
 *           | embeddedsubprocess        +----------+ |
 *           |                     +---->|endInside1| |
 *           |                     |     +----------+ |
 *           |                     |                  |
 * +-----+   |  +-----------+   +----+   +----------+ |   +---+
 * |start|-->|  |startInside|-->|fork|-->|endInside2| |-->|end|
 * +-----+   |  +-----------+   +----+   +----------+ |   +---+
 *           |                     |                  |
 *           |                     |     +----------+ |
 *           |                     +---->|endInside3| |
 *           |                           +----------+ |
 *           +----------------------------------------+
 */
public void testMultipleConcurrentEndsInsideEmbeddedSubProcess() {
    PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).transition("embeddedsubprocess").endActivity().createActivity("embeddedsubprocess").scope().behavior(new EmbeddedSubProcess()).createActivity("startInside").behavior(new Automatic()).transition("fork").endActivity().createActivity("fork").behavior(new ParallelGateway()).transition("endInside1").transition("endInside2").transition("endInside3").endActivity().createActivity("endInside1").behavior(new End()).endActivity().createActivity("endInside2").behavior(new End()).endActivity().createActivity("endInside3").behavior(new End()).endActivity().transition("end").endActivity().createActivity("end").behavior(new End()).endActivity().buildProcessDefinition();
    PvmProcessInstance processInstance = processDefinition.createProcessInstance();
    processInstance.start();
    assertTrue(processInstance.isEnded());
}
Also used : EmbeddedSubProcess(org.camunda.bpm.engine.test.standalone.pvm.activities.EmbeddedSubProcess) 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 14 with EmbeddedSubProcess

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

the class PvmEmbeddedSubProcessTest method testEmbeddedSubProcessWithoutEndEvents.

/**
 *           +------------------------------+
 *           | embedded subprocess          |
 * +-----+   |  +-----------+               |
 * |start|-->|  |startInside|               |
 * +-----+   |  +-----------+               |
 *           +------------------------------+
 */
public void testEmbeddedSubProcessWithoutEndEvents() {
    PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).transition("embeddedsubprocess").endActivity().createActivity("embeddedsubprocess").scope().behavior(new EmbeddedSubProcess()).createActivity("startInside").behavior(new Automatic()).endActivity().endActivity().buildProcessDefinition();
    PvmProcessInstance processInstance = processDefinition.createProcessInstance();
    processInstance.start();
    assertTrue(processInstance.isEnded());
}
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) ProcessDefinitionBuilder(org.camunda.bpm.engine.impl.pvm.ProcessDefinitionBuilder) Automatic(org.camunda.bpm.engine.test.standalone.pvm.activities.Automatic)

Example 15 with EmbeddedSubProcess

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

the class PvmEmbeddedSubProcessTest method testNestedSubProcessBothNoEnd.

/**
 *           +-------------------------------------------------------+
 *           | embedded subprocess                                   |
 *           |                  +--------------------------------+   |
 *           |                  | nested embedded subprocess     |   |
 * +-----+   | +-----------+    |  +-----------+                 |   |
 * |start|-->| |startInside|--> |  |startInside|                 |   |
 * +-----+   | +-----------+    |  +-----------+                 |   |
 *           |                  +--------------------------------+   |
 *           |                                                       |
 *           +-------------------------------------------------------+
 */
public void testNestedSubProcessBothNoEnd() {
    PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).transition("embeddedsubprocess").endActivity().createActivity("embeddedsubprocess").scope().behavior(new EmbeddedSubProcess()).createActivity("startInside").behavior(new Automatic()).transition("nestedSubProcess").endActivity().createActivity("nestedSubProcess").scope().behavior(new EmbeddedSubProcess()).createActivity("startNestedInside").behavior(new Automatic()).endActivity().endActivity().endActivity().buildProcessDefinition();
    PvmProcessInstance processInstance = processDefinition.createProcessInstance();
    processInstance.start();
    assertTrue(processInstance.isEnded());
}
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) 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)18 PvmProcessDefinition (org.camunda.bpm.engine.impl.pvm.PvmProcessDefinition)18 PvmProcessInstance (org.camunda.bpm.engine.impl.pvm.PvmProcessInstance)18 Automatic (org.camunda.bpm.engine.test.standalone.pvm.activities.Automatic)18 EmbeddedSubProcess (org.camunda.bpm.engine.test.standalone.pvm.activities.EmbeddedSubProcess)18 End (org.camunda.bpm.engine.test.standalone.pvm.activities.End)13 WaitState (org.camunda.bpm.engine.test.standalone.pvm.activities.WaitState)8 ArrayList (java.util.ArrayList)6 PvmExecution (org.camunda.bpm.engine.impl.pvm.PvmExecution)4 ParallelGateway (org.camunda.bpm.engine.test.standalone.pvm.activities.ParallelGateway)3 ProcessDefinitionImpl (org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl)2 PvmExecutionImpl (org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl)2 FoxDeleteProcessInstanceCmd (org.camunda.bpm.engine.impl.cmd.FoxDeleteProcessInstanceCmd)1 ExecutionImpl (org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl)1 EventScopeCreatingSubprocess (org.camunda.bpm.engine.test.standalone.pvm.activities.EventScopeCreatingSubprocess)1