Search in sources :

Example 6 with WaitState

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

the class PvmEmbeddedSubProcessTest method testEmbeddedSubProcess.

/**
 *           +------------------------------+
 *           | embedded subprocess          |
 * +-----+   |  +-----------+   +---------+ |   +---+
 * |start|-->|  |startInside|-->|endInside| |-->|end|
 * +-----+   |  +-----------+   +---------+ |   +---+
 *           +------------------------------+
 */
public void testEmbeddedSubProcess() {
    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().transition("end").endActivity().createActivity("end").behavior(new WaitState()).endActivity().buildProcessDefinition();
    PvmProcessInstance processInstance = processDefinition.createProcessInstance();
    processInstance.start();
    List<String> expectedActiveActivityIds = new ArrayList<String>();
    expectedActiveActivityIds.add("end");
    assertEquals(expectedActiveActivityIds, processInstance.findActiveActivityIds());
}
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) 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 7 with WaitState

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

the class PvmParallelTest method testUnstructuredConcurrencyTwoJoins.

public void testUnstructuredConcurrencyTwoJoins() {
    PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).transition("fork").endActivity().createActivity("fork").behavior(new ParallelGateway()).transition("c1").transition("c2").transition("c3").endActivity().createActivity("c1").behavior(new Automatic()).transition("join1").endActivity().createActivity("c2").behavior(new Automatic()).transition("join1").endActivity().createActivity("c3").behavior(new Automatic()).transition("join2").endActivity().createActivity("join1").behavior(new ParallelGateway()).transition("c4").endActivity().createActivity("c4").behavior(new Automatic()).transition("join2").endActivity().createActivity("join2").behavior(new ParallelGateway()).transition("end").endActivity().createActivity("end").behavior(new WaitState()).endActivity().buildProcessDefinition();
    PvmProcessInstance processInstance = processDefinition.createProcessInstance();
    processInstance.start();
    assertNotNull(processInstance.findExecution("end"));
}
Also used : 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) ProcessDefinitionBuilder(org.camunda.bpm.engine.impl.pvm.ProcessDefinitionBuilder) Automatic(org.camunda.bpm.engine.test.standalone.pvm.activities.Automatic)

Example 8 with WaitState

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

the class PvmVariablesTest method testVariables.

@Test
public void testVariables() {
    PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("a").initial().behavior(new WaitState()).endActivity().buildProcessDefinition();
    PvmProcessInstance processInstance = processDefinition.createProcessInstance();
    processInstance.setVariable("amount", 500L);
    processInstance.setVariable("msg", "hello world");
    processInstance.start();
    assertEquals(500L, processInstance.getVariable("amount"));
    assertEquals("hello world", processInstance.getVariable("msg"));
    PvmExecution activityInstance = processInstance.findExecution("a");
    assertEquals(500L, activityInstance.getVariable("amount"));
    assertEquals("hello world", activityInstance.getVariable("msg"));
    Map<String, Object> expectedVariables = new HashMap<String, Object>();
    expectedVariables.put("amount", 500L);
    expectedVariables.put("msg", "hello world");
    assertEquals(expectedVariables, activityInstance.getVariables());
    assertEquals(expectedVariables, processInstance.getVariables());
}
Also used : WaitState(org.camunda.bpm.engine.test.standalone.pvm.activities.WaitState) PvmProcessInstance(org.camunda.bpm.engine.impl.pvm.PvmProcessInstance) HashMap(java.util.HashMap) PvmProcessDefinition(org.camunda.bpm.engine.impl.pvm.PvmProcessDefinition) ProcessDefinitionBuilder(org.camunda.bpm.engine.impl.pvm.ProcessDefinitionBuilder) PvmExecution(org.camunda.bpm.engine.impl.pvm.PvmExecution) Test(org.junit.Test)

Example 9 with WaitState

use of org.camunda.bpm.engine.test.standalone.pvm.activities.WaitState 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 10 with WaitState

use of org.camunda.bpm.engine.test.standalone.pvm.activities.WaitState 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)

Aggregations

ProcessDefinitionBuilder (org.camunda.bpm.engine.impl.pvm.ProcessDefinitionBuilder)22 PvmProcessDefinition (org.camunda.bpm.engine.impl.pvm.PvmProcessDefinition)22 PvmProcessInstance (org.camunda.bpm.engine.impl.pvm.PvmProcessInstance)22 WaitState (org.camunda.bpm.engine.test.standalone.pvm.activities.WaitState)22 Automatic (org.camunda.bpm.engine.test.standalone.pvm.activities.Automatic)20 PvmExecution (org.camunda.bpm.engine.impl.pvm.PvmExecution)11 End (org.camunda.bpm.engine.test.standalone.pvm.activities.End)11 EmbeddedSubProcess (org.camunda.bpm.engine.test.standalone.pvm.activities.EmbeddedSubProcess)8 ArrayList (java.util.ArrayList)6 ParallelGateway (org.camunda.bpm.engine.test.standalone.pvm.activities.ParallelGateway)6 ExecutionImpl (org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl)3 PvmExecutionImpl (org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl)2 EventScopeCreatingSubprocess (org.camunda.bpm.engine.test.standalone.pvm.activities.EventScopeCreatingSubprocess)2 HashMap (java.util.HashMap)1 FoxDeleteProcessInstanceCmd (org.camunda.bpm.engine.impl.cmd.FoxDeleteProcessInstanceCmd)1 ProcessDefinitionImpl (org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl)1 Decision (org.camunda.bpm.engine.test.standalone.pvm.activities.Decision)1 Test (org.junit.Test)1