/// <summary> /// +--+ /// +--->|c1|---+ /// | +--+ | /// | v /// +-----+ +----+ +----+ +---+ /// |start|-->|fork| |join|-->|end| /// +-----+ +----+ +----+ +---+ /// | ^ /// | +--+ | /// +--->|c2|---+ /// +--+ /// </summary> public virtual void testSimpleAutmaticConcurrencyEvents() { 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("fork").endActivity().createActivity("fork").behavior(new ParallelGateway()).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_START, eventCollector).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_END, eventCollector).transition("c1").transition("c2").endActivity().createActivity("c1").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("join").endActivity().createActivity("c2").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("join").endActivity().createActivity("join").behavior(new ParallelGateway()).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_START, eventCollector).executionListener(org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_END, eventCollector).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(); IList <string> expectedEvents = new List <string>(); expectedEvents.Add("start on ProcessDefinition(events)"); 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(c2)"); expectedEvents.Add("end on Activity(c2)"); expectedEvents.Add("start on Activity(join)"); expectedEvents.Add("start on Activity(c1)"); expectedEvents.Add("end on Activity(c1)"); expectedEvents.Add("start on Activity(join)"); expectedEvents.Add("end 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(events)"); assertEquals("expected " + expectedEvents + ", but was \n" + eventCollector + "\n", expectedEvents, eventCollector.events); }
/// <summary> /// +------------------------------+ /// +-----+ | +-----------+ +----------+ | +---+ /// |start|-->| |startInside|-->|endInsdide| |-->|end| /// +-----+ | +-----------+ +----------+ | +---+ /// +------------------------------+ /// </summary> public virtual 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(); IList <string> expectedEvents = new List <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); }
public virtual void testSimpleProcessInstanceEnd() { EventCollector eventCollector = new EventCollector(); PvmProcessDefinition processDefinition = (new ProcessDefinitionBuilder()).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()).transition("wait").endActivity().createActivity("wait").behavior(new WaitState()).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(); Console.Error.WriteLine(eventCollector); processInstance.deleteCascade("test"); Console.Error.WriteLine(); Console.Error.WriteLine(eventCollector); }