use of org.camunda.bpm.engine.impl.pvm.PvmProcessInstance 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.impl.pvm.PvmProcessInstance 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);
}
use of org.camunda.bpm.engine.impl.pvm.PvmProcessInstance in project camunda-bpm-platform by camunda.
the class PvmActivityInstanceCompleteTest method testTwoEnds.
/**
* +----+
* +--->|end1|
* | +----+
* |
* +-----+ +----+
* |start|-->|fork|
* +-----+ +----+
* |
* | +----+
* +--->|end2|
* +----+
*/
public void testTwoEnds() {
ActivityInstanceVerification verifier = new ActivityInstanceVerification();
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("fork").endActivity().createActivity("fork").behavior(new ParallelGateway()).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("end1").transition("end2").endActivity().createActivity("end1").behavior(new End()).executionListener(ExecutionListener.EVENTNAME_END, verifier).endActivity().createActivity("end2").behavior(new End()).executionListener(ExecutionListener.EVENTNAME_END, verifier).endActivity().buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
verifier.assertNonCompletingActivityInstance("start", 1);
verifier.assertNonCompletingActivityInstance("fork", 1);
verifier.assertIsCompletingActivityInstance("end1", 1);
verifier.assertIsCompletingActivityInstance("end2", 1);
}
use of org.camunda.bpm.engine.impl.pvm.PvmProcessInstance in project camunda-bpm-platform by camunda.
the class PvmActivityInstanceCompleteTest method testSingleEnd.
/**
* +-------+ +-----+
* | start |-->| end |
* +-------+ +-----+
*/
public void testSingleEnd() {
ActivityInstanceVerification verifier = new ActivityInstanceVerification();
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("end").endActivity().createActivity("end").behavior(new End()).executionListener(ExecutionListener.EVENTNAME_END, verifier).endActivity().buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
verifier.assertNonCompletingActivityInstance("start", 1);
verifier.assertIsCompletingActivityInstance("end", 1);
}
use of org.camunda.bpm.engine.impl.pvm.PvmProcessInstance in project camunda-bpm-platform by camunda.
the class PvmBasicLinearExecutionTest method testCombinationOfWaitStatesAndAutomatics.
/**
* +-----+ +-----+ +-------+ +------+ +------+
* | one |-->| two |-->| three |-->| four |--> | five |
* +-----+ +-----+ +-------+ +------+ +------+
*/
public void testCombinationOfWaitStatesAndAutomatics() {
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).transition("one").endActivity().createActivity("one").behavior(new WaitState()).transition("two").endActivity().createActivity("two").behavior(new WaitState()).transition("three").endActivity().createActivity("three").behavior(new Automatic()).transition("four").endActivity().createActivity("four").behavior(new Automatic()).transition("five").endActivity().createActivity("five").behavior(new End()).endActivity().buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
PvmExecution activityInstance = processInstance.findExecution("one");
assertNotNull(activityInstance);
activityInstance.signal(null, null);
activityInstance = processInstance.findExecution("two");
assertNotNull(activityInstance);
activityInstance.signal(null, null);
assertEquals(new ArrayList<String>(), processInstance.findActiveActivityIds());
assertTrue(processInstance.isEnded());
}
Aggregations