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 AuctionTextTest extends TestCase { 13 14 static ProcessDefinition auctionProcess = ProcessDefinition.parseXmlString( 16 "<process-definition>" + 17 " <start-state name='start'>" + 18 " <transition to='auction'/>" + 19 " </start-state>" + 20 " <state name='auction'>" + 21 " <transition to='end'/>" + 22 " </state>" + 23 " <end-state name='end'/>" + 24 "</process-definition>"); 25 26 static StartState start = auctionProcess.getStartState(); 28 static State auction = (State) auctionProcess.getNode("auction"); 29 static EndState end = (EndState) auctionProcess.getNode("end"); 30 31 ProcessInstance processInstance; 33 34 Token token; 36 37 public void setUp() { 38 processInstance = new ProcessInstance(auctionProcess); 40 41 token = processInstance.getRootToken(); 43 } 44 45 public void testMainScenario() { 46 assertSame(start, token.getNode()); 49 50 token.signal(); 51 52 assertSame(auction, token.getNode()); 55 56 token.signal(); 57 58 assertSame(end, token.getNode()); 61 assertTrue(processInstance.hasEnded()); 62 } 63 64 } 65 | Popular Tags |