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());
}
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"));
}
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());
}
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"));
}
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);
}
Aggregations