use of org.camunda.bpm.engine.test.standalone.pvm.activities.End in project camunda-bpm-platform by camunda.
the class PvmScopeWaitStateTest method testWaitStateScope.
/**
* +-----+ +----------+ +---+
* |start|-->|scopedWait|-->|end|
* +-----+ +----------+ +---+
*/
public void testWaitStateScope() {
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).transition("scopedWait").endActivity().createActivity("scopedWait").scope().behavior(new WaitState()).transition("end").endActivity().createActivity("end").behavior(new End()).endActivity().buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
PvmExecution execution = processInstance.findExecution("scopedWait");
assertNotNull(execution);
execution.signal(null, null);
assertEquals(new ArrayList<String>(), processInstance.findActiveActivityIds());
assertTrue(processInstance.isEnded());
}
use of org.camunda.bpm.engine.test.standalone.pvm.activities.End in project camunda-bpm-platform by camunda.
the class PvmActivityInstanceTest method testWhileLoop.
/**
* +----------------------------+
* v |
* +-------+ +------+ +-----+ +-----+ +-------+
* | start |-->| loop |-->| one |-->| two |--> | three |
* +-------+ +------+ +-----+ +-----+ +-------+
* |
* | +-----+
* +-->| end |
* +-----+
*/
public void testWhileLoop() {
ActivityInstanceVerification verifier = new ActivityInstanceVerification();
TransitionInstanceVerifyer transitionVerifier = new TransitionInstanceVerifyer();
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).startTransition("loop").executionListener(ExecutionListener.EVENTNAME_TAKE, transitionVerifier).endTransition().endActivity().createActivity("loop").behavior(new While("count", 0, 10)).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).startTransition("one", "more").executionListener(ExecutionListener.EVENTNAME_TAKE, transitionVerifier).endTransition().startTransition("end", "done").executionListener(ExecutionListener.EVENTNAME_TAKE, transitionVerifier).endTransition().endActivity().createActivity("one").behavior(new Automatic()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("two").endActivity().createActivity("two").behavior(new Automatic()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("three").endActivity().createActivity("three").behavior(new Automatic()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("loop").endActivity().createActivity("end").behavior(new End()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).endActivity().buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
assertEquals(new ArrayList<String>(), processInstance.findActiveActivityIds());
assertTrue(processInstance.isEnded());
verifier.assertStartInstanceCount(1, "start");
verifier.assertProcessInstanceParent("start", processInstance);
verifier.assertStartInstanceCount(11, "loop");
verifier.assertProcessInstanceParent("loop", processInstance);
verifier.assertStartInstanceCount(10, "one");
verifier.assertProcessInstanceParent("one", processInstance);
verifier.assertStartInstanceCount(10, "two");
verifier.assertProcessInstanceParent("two", processInstance);
verifier.assertStartInstanceCount(10, "three");
verifier.assertProcessInstanceParent("three", processInstance);
verifier.assertStartInstanceCount(1, "end");
verifier.assertProcessInstanceParent("end", processInstance);
}
use of org.camunda.bpm.engine.test.standalone.pvm.activities.End in project camunda-bpm-platform by camunda.
the class PvmActivityInstanceTest method testScopeActivity.
/**
* +-----+ +-----+ +-------+
* | one |-->| two |-->| three |
* +-----+ +-----+ +-------+
*/
public void testScopeActivity() {
ActivityInstanceVerification verifier = new ActivityInstanceVerification();
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("one").initial().behavior(new Automatic()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("two").endActivity().createActivity("two").scope().behavior(new WaitState()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("three").endActivity().createActivity("three").behavior(new End()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).endActivity().buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
PvmExecution childExecution = processInstance.findExecution("two");
String parentActivityInstanceId = ((ExecutionImpl) childExecution).getParentActivityInstanceId();
assertEquals(((ExecutionImpl) processInstance).getId(), parentActivityInstanceId);
childExecution.signal(null, null);
verifier.assertStartInstanceCount(1, "one");
verifier.assertStartInstanceCount(1, "two");
verifier.assertProcessInstanceParent("two", processInstance);
verifier.assertStartInstanceCount(1, "three");
}
use of org.camunda.bpm.engine.test.standalone.pvm.activities.End in project camunda-bpm-platform by camunda.
the class PvmActivityInstanceTest method testStartInSubProcess.
public void testStartInSubProcess() {
ActivityInstanceVerification verifier = new ActivityInstanceVerification();
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("embeddedsubprocess").endActivity().createActivity("embeddedsubprocess").scope().behavior(new EmbeddedSubProcess()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).createActivity("startInside").behavior(new Automatic()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("endInside").endActivity().createActivity("endInside").behavior(new End()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).endActivity().transition("end").endActivity().executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).createActivity("end").behavior(new End()).executionListener(ExecutionListener.EVENTNAME_START, verifier).executionListener(ExecutionListener.EVENTNAME_END, verifier).endActivity().buildProcessDefinition();
PvmProcessInstance processInstance = ((ProcessDefinitionImpl) processDefinition).createProcessInstanceForInitial((ActivityImpl) processDefinition.findActivity("endInside"));
processInstance.start();
assertTrue(processInstance.isEnded());
verifier.assertStartInstanceCount(0, "start");
verifier.assertStartInstanceCount(1, "embeddedsubprocess");
verifier.assertProcessInstanceParent("embeddedsubprocess", processInstance);
verifier.assertStartInstanceCount(0, "startInside");
verifier.assertIsCompletingActivityInstance("endInside", 1);
verifier.assertStartInstanceCount(1, "end");
}
use of org.camunda.bpm.engine.test.standalone.pvm.activities.End 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());
}
Aggregations