use of org.camunda.bpm.engine.impl.pvm.ProcessDefinitionBuilder 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.ProcessDefinitionBuilder 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());
}
use of org.camunda.bpm.engine.impl.pvm.ProcessDefinitionBuilder in project camunda-bpm-platform by camunda.
the class PvmBasicLinearExecutionTest method testWhileLoop.
/**
* +----------------------------+
* v |
* +-------+ +------+ +-----+ +-----+ +-------+
* | start |-->| loop |-->| one |-->| two |--> | three |
* +-------+ +------+ +-----+ +-----+ +-------+
* |
* | +-----+
* +-->| end |
* +-----+
*/
public void testWhileLoop() {
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).transition("loop").endActivity().createActivity("loop").behavior(new While("count", 0, 10)).transition("one", "more").transition("end", "done").endActivity().createActivity("one").behavior(new Automatic()).transition("two").endActivity().createActivity("two").behavior(new Automatic()).transition("three").endActivity().createActivity("three").behavior(new Automatic()).transition("loop").endActivity().createActivity("end").behavior(new End()).endActivity().buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
assertEquals(new ArrayList<String>(), processInstance.findActiveActivityIds());
assertTrue(processInstance.isEnded());
}
use of org.camunda.bpm.engine.impl.pvm.ProcessDefinitionBuilder in project camunda-bpm-platform by camunda.
the class PvmBasicLinearExecutionTest method testSingleWaitState.
/**
* +-----+ +-----+ +-------+
* | one |-->| two |-->| three |
* +-----+ +-----+ +-------+
*/
public void testSingleWaitState() {
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("one").initial().behavior(new Automatic()).transition("two").endActivity().createActivity("two").behavior(new WaitState()).transition("three").endActivity().createActivity("three").behavior(new End()).endActivity().buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
PvmExecution activityInstance = processInstance.findExecution("two");
assertNotNull(activityInstance);
activityInstance.signal(null, null);
assertEquals(new ArrayList<String>(), processInstance.findActiveActivityIds());
assertTrue(processInstance.isEnded());
}
use of org.camunda.bpm.engine.impl.pvm.ProcessDefinitionBuilder in project camunda-bpm-platform by camunda.
the class PvmParallelEndTest method testParallelEnd.
/**
* +----+
* +--->|end1|
* | +----+
* |
* +-----+ +----+
* |start|-->|fork|
* +-----+ +----+
* |
* | +----+
* +--->|end2|
* +----+
*/
public void testParallelEnd() {
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).transition("fork").endActivity().createActivity("fork").behavior(new ParallelGateway()).transition("end1").transition("end2").endActivity().createActivity("end1").behavior(new End()).endActivity().createActivity("end2").behavior(new End()).endActivity().buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
assertTrue(processInstance.isEnded());
}
Aggregations