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 9 13 public class DPE2ExampleTest extends AbstractExeTestCase { 14 private Flow flow; 15 private Receive a; 16 private Receive b; 17 private Receive c; 18 private Receive x; 19 private Receive y; 20 21 29 30 public void initActivities() { 31 a = (Receive) flow.getNode("A"); 32 b = (Receive) flow.getNode("B"); 33 c = (Receive) flow.getNode("C"); 34 x = (Receive) flow.getNode("X"); 35 y = (Receive) flow.getNode("Y"); 36 } 37 38 public void testFail() throws Exception { 39 flow = (Flow) readActivity(getClass().getResource("DPE2-Example.bpel"), false); 40 flow.setSuppressJoinFailure(Boolean.FALSE); 41 setNestedBlock(flow); 42 assertExecution(); 43 } 44 45 public void testSuppress() throws Exception { 46 flow = (Flow) readActivity(getClass().getResource("DPE2-Example.bpel"), false); 47 flow.setSuppressJoinFailure(Boolean.TRUE); 48 setNestedBlock(flow); 49 assertExecution(); 50 } 51 52 public void testInitialFail() throws Exception { 53 flow = (Flow) readActivity(getClass().getResource("DPE2-Example.bpel"), true); 54 flow.setSuppressJoinFailure(Boolean.FALSE); 55 setRootBlock(flow); 56 assertInitialExecution(); 57 } 58 59 public void testInitialSuppress() throws Exception { 60 flow = (Flow) readActivity(getClass().getResource("DPE2-Example.bpel"), true); 61 flow.setSuppressJoinFailure(Boolean.FALSE); 62 setRootBlock(flow); 63 assertInitialExecution(); 64 } 65 66 public void assertExecution() throws Exception { 67 initActivities(); 68 Token startToken = startNested(); 69 70 Token tokenA = findToken(startToken, a); 73 Token tokenB = findToken(startToken, b); 74 Token tokenC = findToken(startToken, c); 75 Token tokenX = findToken(startToken, x); 76 Token tokenY = findToken(startToken, y); 77 78 assertReceiveAndAdvance( tokenA, a, flow.getEnd() ); 80 assertReceiveDisabled( tokenB, b ); 82 83 assertReceiveAndAdvance( tokenX, x, flow.getEnd() ); 85 assertReceiveAndAdvance( tokenY, y, flow.getEnd() ); 88 assertReceiveAndAdvance( tokenB, b, flow.getEnd() ); 90 91 assertReceiveAndComplete( tokenC, c ); 93 } 94 95 public void assertInitialExecution() throws Exception { 96 initActivities(); 97 a.setCreateInstance(true); 98 Token startToken = startInitial(a.getReceiver()); 99 103 Token tokenB = findToken(startToken, b); 105 assertReceiveDisabled( tokenB, b ); 107 108 Token tokenC = findToken(startToken, c); 109 Token tokenX = findToken(startToken, x); 110 Token tokenY = findToken(startToken, y); 111 112 assertReceiveAndAdvance( tokenX, x, flow.getEnd() ); 114 assertReceiveAndAdvance( tokenY, y, flow.getEnd() ); 117 assertReceiveAndAdvance( tokenB, b, flow.getEnd() ); 119 120 assertReceiveAndComplete( tokenC, c ); 122 } 123 } 124 | Popular Tags |