1 package org.jbpm.tdd; 2 3 import junit.framework.TestCase; 4 5 import org.jbpm.graph.def.ProcessDefinition; 6 import org.jbpm.graph.exe.ProcessInstance; 7 import org.jbpm.graph.exe.Token; 8 import org.jbpm.graph.node.EndState; 9 import org.jbpm.graph.node.StartState; 10 import org.jbpm.graph.node.State; 11 12 public class AuctionParTest extends TestCase { 13 14 static ProcessDefinition auctionProcess = 16 ProcessDefinition.parseParResource("org/jbpm/tdd/auction.par"); 17 18 static StartState start = auctionProcess.getStartState(); 20 static State auction = (State) auctionProcess.getNode("auction"); 21 static EndState end = (EndState) auctionProcess.getNode("end"); 22 23 ProcessInstance processInstance; 25 26 Token token; 28 29 public void setUp() { 30 processInstance = new ProcessInstance(auctionProcess); 32 33 token = processInstance.getRootToken(); 35 } 36 37 public void testMainScenario() { 38 assertSame(start, token.getNode()); 41 42 token.signal(); 43 44 assertSame(auction, token.getNode()); 47 48 token.signal(); 49 50 assertSame(end, token.getNode()); 53 assertTrue(processInstance.hasEnded()); 54 } 55 } 56 | Popular Tags |