Search in sources :

Example 16 with PvmExecution

use of org.activiti.engine.impl.pvm.PvmExecution in project Activiti by Activiti.

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.activiti.engine.test.pvm.activities.EmbeddedSubProcess) WaitState(org.activiti.engine.test.pvm.activities.WaitState) PvmProcessInstance(org.activiti.engine.impl.pvm.PvmProcessInstance) ParallelGateway(org.activiti.engine.test.pvm.activities.ParallelGateway) PvmProcessDefinition(org.activiti.engine.impl.pvm.PvmProcessDefinition) End(org.activiti.engine.test.pvm.activities.End) ProcessDefinitionBuilder(org.activiti.engine.impl.pvm.ProcessDefinitionBuilder) Automatic(org.activiti.engine.test.pvm.activities.Automatic) PvmExecution(org.activiti.engine.impl.pvm.PvmExecution)

Aggregations

ProcessDefinitionBuilder (org.activiti.engine.impl.pvm.ProcessDefinitionBuilder)16 PvmExecution (org.activiti.engine.impl.pvm.PvmExecution)16 PvmProcessDefinition (org.activiti.engine.impl.pvm.PvmProcessDefinition)16 PvmProcessInstance (org.activiti.engine.impl.pvm.PvmProcessInstance)16 WaitState (org.activiti.engine.test.pvm.activities.WaitState)15 Automatic (org.activiti.engine.test.pvm.activities.Automatic)14 End (org.activiti.engine.test.pvm.activities.End)11 ArrayList (java.util.ArrayList)9 ParallelGateway (org.activiti.engine.test.pvm.activities.ParallelGateway)6 EmbeddedSubProcess (org.activiti.engine.test.pvm.activities.EmbeddedSubProcess)2 HashMap (java.util.HashMap)1 ActivityImpl (org.activiti.engine.impl.pvm.process.ActivityImpl)1 ProcessDefinitionImpl (org.activiti.engine.impl.pvm.process.ProcessDefinitionImpl)1 EventScopeCreatingSubprocess (org.activiti.engine.test.pvm.activities.EventScopeCreatingSubprocess)1