1 package org.jbpm.bpel.exe; 2 3 import org.jbpm.graph.exe.Token; 4 5 import org.jbpm.bpel.def.Receive; 6 import org.jbpm.bpel.def.Sequence; 7 8 12 public class SequenceExeTest extends AbstractExeTestCase { 13 Sequence sequence; 14 Receive receiveA; 15 Receive receiveB; 16 Receive receiveC; 17 18 public void initActivities() { 19 receiveA = (Receive) sequence.getNode("a"); 20 receiveB = (Receive) sequence.getNode("b"); 21 receiveC = (Receive) sequence.getNode("c"); 22 } 23 24 public void testInitialSequence() throws Exception { 25 String xml = 26 "<sequence>" + 27 " <receive name='a' createInstance='yes' partnerLink='aPartner' operation='o'/>" + 28 " <receive name='b' partnerLink='aPartner' operation='o'/>" + 29 " <receive name='c' partnerLink='aPartner' operation='o'/>" + 30 "</sequence>"; 31 32 sequence = (Sequence) readActivity(xml, true); 33 setRootBlock(sequence); 34 initActivities(); 35 Token token = startInitial(receiveA.getReceiver()); 36 assertReceiveAndAdvance(token, receiveB, receiveC); 37 assertReceiveAndComplete(token, receiveC); 38 } 39 40 public void testNestedSequence() throws Exception { 41 String xml = 42 "<sequence>" + 43 " <receive name='a' partnerLink='aPartner' operation='o'/>" + 44 " <receive name='b' partnerLink='aPartner' operation='o'/>" + 45 " <receive name='c' partnerLink='aPartner' operation='o'/>" + 46 "</sequence>"; 47 48 sequence = (Sequence) readActivity(xml, false); 49 setNestedBlock(sequence); 50 initActivities(); 51 Token token = startNested(); 52 assertReceiveAndAdvance(token, receiveA, receiveB); 53 assertReceiveAndAdvance(token, receiveB, receiveC); 54 assertReceiveAndComplete(token, receiveC); 55 } 56 } 57 | Popular Tags |