.executionListener(org.activiti.engine.impl.pvm.PvmEvent.EVENTNAME_START, eventCollector)
.executionListener(org.activiti.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(scopes and concurrency)");
expectedEvents.add("start on Activity(start)");
expectedEvents.add("end on Activity(start)");
expectedEvents.add("start on Activity(fork)");
expectedEvents.add("end on Activity(fork)");
expectedEvents.add("start on Activity(noscope)");
expectedEvents.add("start on Activity(c1)");
expectedEvents.add("end on Activity(fork)");
expectedEvents.add("start on Activity(noscope)");
expectedEvents.add("start on Activity(c2)");
assertEquals("expected "+expectedEvents+", but was \n"+eventCollector+"\n", expectedEvents, eventCollector.events);
eventCollector.events.clear();
PvmExecution execution = processInstance.findExecution("c1");
execution.signal(null, null);
expectedEvents = new ArrayList<String>();
expectedEvents.add("end on Activity(c1)");
expectedEvents.add("end on Activity(noscope)");
expectedEvents.add("start on Activity(join)");
assertEquals("expected "+expectedEvents+", but was \n"+eventCollector+"\n", expectedEvents, eventCollector.events);
eventCollector.events.clear();
execution = processInstance.findExecution("c2");
execution.signal(null, null);
expectedEvents = new ArrayList<String>();
expectedEvents.add("end on Activity(c2)");
expectedEvents.add("end on Activity(noscope)");
expectedEvents.add("start on Activity(join)");
expectedEvents.add("end on Activity(join)");
expectedEvents.add("start on Activity(end)");
expectedEvents.add("end on Activity(end)");
expectedEvents.add("end on ProcessDefinition(scopes and concurrency)");
assertEquals("expected "+expectedEvents+", but was \n"+eventCollector+"\n", expectedEvents, eventCollector.events);
eventCollector.events.clear();
assertTrue(processInstance.isEnded());
}