Search in sources :

Example 6 with EmbeddedSubProcess

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

the class PvmEmbeddedSubProcessTest method testEmbeddedSubProcessNoEnd.

/**
 *           +------------------------------+
 *           | embedded subprocess          |
 * +-----+   |  +-----------+   +---------+ |
 * |start|-->|  |startInside|-->|endInside| |
 * +-----+   |  +-----------+   +---------+ |
 *           +------------------------------+
 */
public void testEmbeddedSubProcessNoEnd() {
    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("endInside").endActivity().createActivity("endInside").behavior(new End()).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) 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 7 with EmbeddedSubProcess

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

the class PvmEventTest method testEmbeddedSubProcessEvents.

/**
 *           +------------------------------+
 * +-----+   | +-----------+   +----------+ |   +---+
 * |start|-->| |startInside|-->|endInsdide| |-->|end|
 * +-----+   | +-----------+   +----------+ |   +---+
 *           +------------------------------+
 */
public void testEmbeddedSubProcessEvents() {
    EventCollector eventCollector = new EventCollector();
    PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder("events").executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_START, eventCollector).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_END, eventCollector).createActivity("start").initial().behavior(new Automatic()).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_START, eventCollector).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_END, eventCollector).transition("embeddedsubprocess").endActivity().createActivity("embeddedsubprocess").scope().behavior(new EmbeddedSubProcess()).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_START, eventCollector).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_END, eventCollector).createActivity("startInside").behavior(new Automatic()).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_START, eventCollector).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_END, eventCollector).transition("endInside").endActivity().createActivity("endInside").behavior(new End()).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_START, eventCollector).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_END, eventCollector).endActivity().transition("end").endActivity().createActivity("end").behavior(new End()).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_START, eventCollector).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_END, eventCollector).endActivity().buildProcessDefinition();
    PvmProcessInstance processInstance = processDefinition.createProcessInstance();
    processInstance.start();
    List<String> expectedEvents = new ArrayList<String>();
    expectedEvents.add("start on ProcessDefinition(events)");
    expectedEvents.add("start on Activity(start)");
    expectedEvents.add("end on Activity(start)");
    expectedEvents.add("start on Activity(embeddedsubprocess)");
    expectedEvents.add("start on Activity(startInside)");
    expectedEvents.add("end on Activity(startInside)");
    expectedEvents.add("start on Activity(endInside)");
    expectedEvents.add("end on Activity(endInside)");
    expectedEvents.add("end on Activity(embeddedsubprocess)");
    expectedEvents.add("start on Activity(end)");
    expectedEvents.add("end on Activity(end)");
    expectedEvents.add("end on ProcessDefinition(events)");
    assertEquals("expected " + expectedEvents + ", but was \n" + eventCollector + "\n", expectedEvents, eventCollector.events);
}
Also used : EmbeddedSubProcess(org.camunda.bpm.engine.test.standalone.pvm.activities.EmbeddedSubProcess) PvmProcessInstance(org.camunda.bpm.engine.impl.pvm.PvmProcessInstance) ArrayList(java.util.ArrayList) 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 8 with EmbeddedSubProcess

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

the class PvmActivityInstanceTest method testMultipleConcurrentEndsInsideEmbeddedSubProcessWithWaitState.

/**
 *           +-------------------------------------------------+
 *           | embeddedsubprocess        +----------+          |
 *           |                     +---->|endInside1|          |
 *           |                     |     +----------+          |
 *           |                     |                           |
 * +-----+   |  +-----------+   +----+   +----+   +----------+ |   +---+
 * |start|-->|  |startInside|-->|fork|-->|wait|-->|endInside2| |-->|end|
 * +-----+   |  +-----------+   +----+   +----+   +----------+ |   +---+
 *           |                     |                           |
 *           |                     |     +----------+          |
 *           |                     +---->|endInside3|          |
 *           |                           +----------+          |
 *           +-------------------------------------------------+
 */
public void testMultipleConcurrentEndsInsideEmbeddedSubProcessWithWaitState() {
    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("fork").endActivity().createActivity("fork").behavior(new ParallelGateway()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("endInside1").transition("wait").transition("endInside3").endActivity().createActivity("endInside1").behavior(new End()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).endActivity().createActivity("wait").behavior(new WaitState()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("endInside2").endActivity().createActivity("endInside2").behavior(new End()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).endActivity().createActivity("endInside3").behavior(new End()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).endActivity().transition("end").endActivity().createActivity("end").behavior(new End()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).endActivity().buildProcessDefinition();
    PvmProcessInstance processInstance = processDefinition.createProcessInstance();
    processInstance.start();
    assertFalse(processInstance.isEnded());
    PvmExecution execution = processInstance.findExecution("wait");
    execution.signal(null, null);
    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, "fork");
    verifier.assertParent("fork", "embeddedsubprocess");
    verifier.assertStartInstanceCount(1, "wait");
    verifier.assertParent("wait", "embeddedsubprocess");
    verifier.assertStartInstanceCount(1, "endInside1");
    verifier.assertParent("endInside1", "embeddedsubprocess");
    verifier.assertStartInstanceCount(1, "endInside2");
    verifier.assertParent("endInside2", "embeddedsubprocess");
    verifier.assertStartInstanceCount(1, "endInside3");
    verifier.assertParent("endInside3", "embeddedsubprocess");
    verifier.assertStartInstanceCount(1, "end");
    verifier.assertProcessInstanceParent("end", processInstance);
}
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 9 with EmbeddedSubProcess

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

the class PvmActivityInstanceTest method testNestedSubProcessNoEnd.

/**
 *           +-------------------------------------------------------+
 *           | embedded subprocess                                   |
 *           |                  +--------------------------------+   |
 *           |                  | nested embedded subprocess     |   |
 * +-----+   | +-----------+    |  +-----------+   +---------+   |   |   +---+
 * |start|-->| |startInside|--> |  |startInside|-->|endInside|   |   |-->|end|
 * +-----+   | +-----------+    |  +-----------+   +---------+   |   |   +---+
 *           |                  +--------------------------------+   |
 *           |                                                       |
 *           +-------------------------------------------------------+
 */
public void testNestedSubProcessNoEnd() {
    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).transition("endInside").endActivity().createActivity("endInside").behavior(new End()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).endActivity().endActivity().transition("end").endActivity().createActivity("end").behavior(new End()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).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");
    verifier.assertStartInstanceCount(1, "endInside");
    verifier.assertParent("endInside", "nestedSubProcess");
    verifier.assertStartInstanceCount(1, "end");
    verifier.assertProcessInstanceParent("end", processInstance);
}
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 10 with EmbeddedSubProcess

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

the class PvmActivityInstanceTest method testSubProcessNoEnd.

public void testSubProcessNoEnd() {
    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).endActivity().endActivity().executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).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.assertStartInstanceCount(1, "startInside");
}
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