1 package org.jbpm.jpdl.patterns; 2 3 import junit.framework.*; 4 5 import org.jbpm.graph.def.*; 6 import org.jbpm.graph.exe.*; 7 8 11 public class Wfp17DeferredChoiceTest extends TestCase { 12 13 public static ProcessDefinition deferredChoiceProcessDefinition = createDeferredChoiceProcessDefinition(); 14 15 public static ProcessDefinition createDeferredChoiceProcessDefinition() { 16 ProcessDefinition pd = new ProcessDefinition( 17 new String []{"start-state start", 18 "state a", 19 "state b", 20 "state c"}, 21 new String []{"start --> a", 22 "a --to a--> b", 23 "a --to b--> c"}); 24 return pd; 25 } 26 27 public void testDeferredChoiceScenario1() { 28 ProcessDefinition pd = deferredChoiceProcessDefinition; 29 30 ProcessInstance pi = new ProcessInstance( pd ); 31 pi.signal(); 32 Token root = pi.getRootToken(); 33 assertSame( pd.getNode("a"), root.getNode() ); 34 root.signal("to a"); assertSame( pd.getNode("b"), root.getNode() ); 36 } 37 38 public void testDeferredChoiceScenario2() { 39 ProcessDefinition pd = deferredChoiceProcessDefinition; 40 41 ProcessInstance pi = new ProcessInstance( pd ); 42 pi.signal(); 43 Token root = pi.getRootToken(); 44 assertSame( pd.getNode("a"), root.getNode() ); 45 root.signal("to b"); assertSame( pd.getNode("c"), root.getNode() ); 47 } 48 49 } 50 | Popular Tags |