public static ProcessDefinition createMilestoneProcessDefinition() { ProcessDefinition pd = new ProcessDefinition( new String[] { "start-state start", "fork fork", "state b", "milestone-node m", "state c", "state d", "join join", "end-state end" }, new String[] { "start --> fork", "fork --m--> b", "fork --d--> d", "b --> m", "m --> c", "c --> join", "d --> join", "join --> end" }); Node d = pd.getNode("d"); Delegation instantiatableDelegate = new Delegation(new MilestoneEvent("m", "../m")); Event event = new Event(Event.EVENTTYPE_NODE_LEAVE); d.addEvent(event); event.addAction(new Action(instantiatableDelegate)); pd.addDefinition(new ContextDefinition()); return pd; }
public void testMilestoneScenario1() { ProcessDefinition pd = milestoneProcessDefinition; Token root = startScenario(); Token tokenM = root.getChild("m"); Token tokenD = root.getChild("d"); assertSame(pd.getNode("b"), tokenM.getNode()); assertSame(pd.getNode("d"), tokenD.getNode()); tokenM.signal(); assertSame(pd.getNode("m"), tokenM.getNode()); assertSame(pd.getNode("d"), tokenD.getNode()); tokenD.signal(); assertSame(pd.getNode("c"), tokenM.getNode()); assertSame(pd.getNode("join"), tokenD.getNode()); }