1 package org.jbpm.bpel.def; 2 3 import org.jbpm.bpel.data.def.Snippet; 4 import org.jbpm.bpel.db.AbstractDbTestCase; 5 6 public class FlowDbTest extends AbstractDbTestCase { 7 8 public void testLinks() { 9 BpelDefinition processDefinition = new BpelDefinition(); 10 Flow flow = new Flow("parent"); 11 processDefinition.addNode(flow); 12 Activity activity = new Empty("linked"); 13 flow.addNode(activity); 14 Link a = new Link("a"); 15 Snippet expression = new Snippet(); 16 expression.setUse(Snippet.Use.EXPRESSION); 17 a.setTransitionCondition(expression); 18 Link b = new Link("b"); 19 activity.addTarget(a); 20 activity.addSource(b); 21 flow.addLink(a); 22 flow.addLink(b); 23 24 processDefinition = saveAndReload(processDefinition); 25 26 flow = (Flow) processDefinition.getNode("parent"); 27 assertEquals(2, flow.getLinks().size()); 28 29 a = flow.getLink("a"); 30 assertNotNull( a.getTransitionCondition() ); 31 assertEquals("linked", a.getTarget().getName()); 32 33 b= flow.getLink("b"); 34 assertNull( b.getTransitionCondition() ); 35 assertEquals("linked", b.getSource().getName()); 36 } 37 38 public void testConnections() { 39 BpelDefinition processDefinition = new BpelDefinition(); 40 41 Flow flow = new Flow("parent"); 42 processDefinition.addNode(flow); 43 Activity activity = new Empty("activity"); 44 flow.addNode(activity); 45 46 processDefinition = saveAndReload(processDefinition); 47 48 flow = (Flow) processDefinition.getNode("parent"); 49 50 Activity start = flow.getStart(); 51 Activity end = flow.getEnd(); 52 53 activity = (Activity) flow.getNode("activity"); 54 55 assertTrue(start.getLeavingTransitions().contains(activity.getDefaultArrivingTransition())); 56 assertTrue(end.getArrivingTransitions().contains(activity.getDefaultLeavingTransition())); 57 } 58 } | Popular Tags |