use of org.camunda.bpm.engine.impl.pvm.PvmProcessInstance in project camunda-bpm-platform by camunda.
the class PvmEmbeddedSubProcessTest method testEmbeddedSubProcessNoEnd.
/**
* +------------------------------+
* | embedded subprocess |
* +-----+ | +-----------+ +---------+ |
* |start|-->| |startInside|-->|endInside| |
* +-----+ | +-----------+ +---------+ |
* +------------------------------+
*/
public void testEmbeddedSubProcessNoEnd() {
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().endActivity().buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
assertTrue(processInstance.isEnded());
}
use of org.camunda.bpm.engine.impl.pvm.PvmProcessInstance in project camunda-bpm-platform by camunda.
the class PvmEventTest method testEmbeddedSubProcessEvents.
/**
* +------------------------------+
* +-----+ | +-----------+ +----------+ | +---+
* |start|-->| |startInside|-->|endInsdide| |-->|end|
* +-----+ | +-----------+ +----------+ | +---+
* +------------------------------+
*/
public void testEmbeddedSubProcessEvents() {
EventCollector eventCollector = new EventCollector();
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder("events").executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_START, eventCollector).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_END, eventCollector).createActivity("start").initial().behavior(new Automatic()).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_START, eventCollector).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_END, eventCollector).transition("embeddedsubprocess").endActivity().createActivity("embeddedsubprocess").scope().behavior(new EmbeddedSubProcess()).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_START, eventCollector).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_END, eventCollector).createActivity("startInside").behavior(new Automatic()).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_START, eventCollector).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_END, eventCollector).transition("endInside").endActivity().createActivity("endInside").behavior(new End()).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_START, eventCollector).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_END, eventCollector).endActivity().transition("end").endActivity().createActivity("end").behavior(new End()).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_START, eventCollector).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_END, eventCollector).endActivity().buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
List<String> expectedEvents = new ArrayList<String>();
expectedEvents.add("start on ProcessDefinition(events)");
expectedEvents.add("start on Activity(start)");
expectedEvents.add("end on Activity(start)");
expectedEvents.add("start on Activity(embeddedsubprocess)");
expectedEvents.add("start on Activity(startInside)");
expectedEvents.add("end on Activity(startInside)");
expectedEvents.add("start on Activity(endInside)");
expectedEvents.add("end on Activity(endInside)");
expectedEvents.add("end on Activity(embeddedsubprocess)");
expectedEvents.add("start on Activity(end)");
expectedEvents.add("end on Activity(end)");
expectedEvents.add("end on ProcessDefinition(events)");
assertEquals("expected " + expectedEvents + ", but was \n" + eventCollector + "\n", expectedEvents, eventCollector.events);
}
use of org.camunda.bpm.engine.impl.pvm.PvmProcessInstance in project camunda-bpm-platform by camunda.
the class PvmEventTest method testStartEndEvents.
/**
* +-------+ +-----+
* | start |-->| end |
* +-------+ +-----+
*/
public void testStartEndEvents() {
EventCollector eventCollector = new EventCollector();
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder("events").executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_START, eventCollector).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_END, eventCollector).createActivity("start").initial().behavior(new Automatic()).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_START, eventCollector).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_END, eventCollector).startTransition("end").executionListener(eventCollector).endTransition().endActivity().createActivity("end").behavior(new End()).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_START, eventCollector).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_END, eventCollector).endActivity().buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
List<String> expectedEvents = new ArrayList<String>();
expectedEvents.add("start on ProcessDefinition(events)");
expectedEvents.add("start on Activity(start)");
expectedEvents.add("end on Activity(start)");
expectedEvents.add("take on (start)-->(end)");
expectedEvents.add("start on Activity(end)");
expectedEvents.add("end on Activity(end)");
expectedEvents.add("end on ProcessDefinition(events)");
assertEquals("expected " + expectedEvents + ", but was \n" + eventCollector + "\n", expectedEvents, eventCollector.events);
}
use of org.camunda.bpm.engine.impl.pvm.PvmProcessInstance 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.impl.pvm.PvmProcessInstance 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());
}
Aggregations