use of org.camunda.bpm.engine.impl.pvm.PvmProcessInstance in project camunda-bpm-platform by camunda.
the class PvmActivityInstanceCompleteTest method testBoundaryEvent.
/**
* +----------+
* | userTask |
* | |
* +-----+ | | +------+
* |start|-->| |--->| end1 |
* +-----+ | +-----+ |
* +-|timer|--+
* +-----+
* | +------+
* +--------->| end2 |
* +------+
*/
public void testBoundaryEvent() {
ActivityInstanceVerification verifier = new ActivityInstanceVerification();
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("userTask").endActivity().createActivity("userTask").scope().behavior(new EmbeddedSubProcess()).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("end1").endActivity().createActivity("timer").behavior(new WaitState()).executionListener(ExecutionListener.EVENTNAME_END, verifier).attachedTo("userTask", true).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();
PvmExecution userTaskExecution = processInstance.findExecution("userTask");
((PvmExecutionImpl) userTaskExecution).executeActivity(processDefinition.findActivity("timer"));
PvmExecution timerExecution = processInstance.findExecution("timer");
timerExecution.signal(null, null);
verifier.assertNonCompletingActivityInstance("start", 1);
verifier.assertNonCompletingActivityInstance("userTask", 1);
verifier.assertIsCompletingActivityInstance("end2", 1);
}
use of org.camunda.bpm.engine.impl.pvm.PvmProcessInstance in project camunda-bpm-platform by camunda.
the class PvmBasicLinearExecutionTest method testStartEnd.
/**
* +-------+ +-----+
* | start |-->| end |
* +-------+ +-----+
*/
public void testStartEnd() {
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).transition("end").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.PvmProcessInstance in project camunda-bpm-platform by camunda.
the class PvmBasicLinearExecutionTest method testSingleAutomatic.
/**
* +-----+ +-----+ +-------+
* | one |-->| two |-->| three |
* +-----+ +-----+ +-------+
*/
public void testSingleAutomatic() {
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("one").initial().behavior(new Automatic()).transition("two").endActivity().createActivity("two").behavior(new Automatic()).transition("three").endActivity().createActivity("three").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.PvmProcessInstance in project camunda-bpm-platform by camunda.
the class PvmEventScopesTest method testTransitionDestroysEventScope.
/**
* +----------------------------------------------------------------------+
* | embedded subprocess |
* | |
* | create evt scope --+ |
* | | |
* | v |
* | |
* | +--------------------------------+ |
* | | nested embedded subprocess | |
* +-----+ | +-----------+ | +-----------------+ | +----+ +---+ | +---+
* |start|-->| |startInside|--> | |startNestedInside| |-->|wait|-->|end| |-->|end|
* +-----+ | +-----------+ | +-----------------+ | +----+ +---+ | +---+
* | +--------------------------------+ |
* | |
* +----------------------------------------------------------------------+
*
* ^
* |
* destroy evt scope --+
*/
public void testTransitionDestroysEventScope() {
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("nestedSubProcess").endActivity().createActivity("nestedSubProcess").scope().behavior(new EventScopeCreatingSubprocess()).createActivity("startNestedInside").behavior(new Automatic()).endActivity().transition("wait").endActivity().createActivity("wait").behavior(new WaitState()).transition("endInside").endActivity().createActivity("endInside").behavior(new Automatic()).endActivity().transition("end").endActivity().createActivity("end").behavior(new Automatic()).endActivity().buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
List<String> expectedActiveActivityIds = new ArrayList<String>();
expectedActiveActivityIds.add("wait");
assertEquals(expectedActiveActivityIds, processInstance.findActiveActivityIds());
PvmExecution execution = processInstance.findExecution("wait");
execution.signal(null, null);
assertTrue(processInstance.isEnded());
}
use of org.camunda.bpm.engine.impl.pvm.PvmProcessInstance in project camunda-bpm-platform by camunda.
the class PvmEventScopesTest method testActivityEndDestroysEventScopes.
/**
* create evt scope --+
* |
* v
*
* +------------------------------+
* | embedded subprocess |
* +-----+ | +-----------+ +---------+ | +----+ +---+
* |start|-->| |startInside|-->|endInside| |-->|wait|-->|end|
* +-----+ | +-----------+ +---------+ | +----+ +---+
* +------------------------------+
*
* ^
* |
* destroy evt scope --+
*/
public void testActivityEndDestroysEventScopes() {
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).transition("embeddedsubprocess").endActivity().createActivity("embeddedsubprocess").scope().behavior(new EventScopeCreatingSubprocess()).createActivity("startInside").behavior(new Automatic()).transition("endInside").endActivity().createActivity("endInside").behavior(new Automatic()).endActivity().transition("wait").endActivity().createActivity("wait").behavior(new WaitState()).transition("end").endActivity().createActivity("end").behavior(new Automatic()).endActivity().buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
boolean eventScopeFound = false;
List<ExecutionImpl> executions = ((ExecutionImpl) processInstance).getExecutions();
for (ExecutionImpl executionImpl : executions) {
if (executionImpl.isEventScope()) {
eventScopeFound = true;
break;
}
}
assertTrue(eventScopeFound);
processInstance.signal(null, null);
assertTrue(processInstance.isEnded());
}
Aggregations