1 package org.jbpm.bpel.exe.flow; 2 3 import org.jbpm.graph.exe.Token; 4 5 import org.jbpm.bpel.def.Flow; 6 import org.jbpm.bpel.def.Receive; 7 import org.jbpm.bpel.exe.AbstractExeTestCase; 8 import org.jbpm.bpel.exe.LinkInstance; 9 10 14 public class LinkScopingExampleTest extends AbstractExeTestCase { 15 16 private Flow f1; 17 private Flow f2; 18 private Receive r1; 19 private Receive r2; 20 private Receive nestedR1; 21 private Receive nestedR2; 22 23 public void initActivities() { 24 f2 = (Flow) f1.getNode("F2"); 25 r1 = (Receive) f1.getNode("R1"); 26 r2 = (Receive) f1.getNode("R2"); 27 nestedR1 = (Receive) f2.getNode("R1"); 28 nestedR2 = (Receive) f2.getNode("R2"); 29 } 30 31 public void testNested() throws Exception { 32 f1 = (Flow) 33 readActivity(getClass().getResource("linkScopingExample.bpel"), false); 34 setNestedBlock(f1); 35 initActivities(); 36 37 Token startToken = startNested(); 38 Token r1Token = findToken( startToken, r1 ); 39 Token r2Token = findToken( startToken, r2 ); 40 Token nestedR1Token = findToken( startToken, nestedR1 ); 41 Token nestedR2Token = findToken( startToken, nestedR2 ); 42 43 assertReceiveDisabled( r2Token, r2 ); 44 assertReceiveDisabled(nestedR2Token, nestedR2 ); 45 46 assertReceiveAndAdvance(r1Token, r1, f1.getEnd()); 48 49 assertEquals(Boolean.FALSE, LinkInstance.get(r1Token, "L1").getReached()); 51 assertEquals(null, LinkInstance.get(nestedR1Token, "L1").getReached()); 52 53 assertReceiveDisabled( r2Token, r2 ); 55 assertReceiveDisabled( nestedR2Token, nestedR2 ); 56 assertReceiveAndAdvance( nestedR1Token, nestedR1, f2.getEnd() ); 57 assertReceiveAndComplete( nestedR2Token, nestedR2) ; 58 } 59 60 public void testInitial() throws Exception { 61 f1 = (Flow) 62 readActivity(getClass().getResource("linkScopingExample.bpel"), true); 63 setRootBlock(f1); 64 initActivities(); 65 nestedR1.setCreateInstance(true); 66 67 Token startToken = startInitial( nestedR1.getReceiver() ); 68 Token f2Token = startToken.getChild(f2.getName()); 69 Token nestedR1Token = f2Token.getChild(nestedR1.getName()); 71 assertSame( f2.getEnd(), nestedR1Token.getNode() ); 72 73 assertEquals(Boolean.TRUE, LinkInstance.get(f2Token, "L1").getReached()); 75 assertEquals(null, LinkInstance.get(startToken, "L1").getReached()); 76 77 Token nestedR2Token = f2Token.getChild(nestedR2.getName()); 78 assertReceiveAndAdvance(nestedR2Token, nestedR2, f2.getEnd()); 80 assertEquals(f1.getEnd(), f2Token.getNode()); 81 82 Token r2Token = startToken.getChild(r2.getName()); 83 assertEquals(r2, r2Token.getNode()); 85 assertReceiveDisabled( r2Token, r2 ); 86 87 Token r1Token = startToken.getChild(r1.getName()); 88 assertReceiveAndComplete(r1Token, r1); 89 assertReceiveDisabled( r2Token, r2); 91 } 92 } 93 | Popular Tags |