1 package org.jbpm.bpel.def; 2 3 import org.jbpm.graph.def.Transition; 4 5 import org.jbpm.bpel.db.AbstractDbTestCase; 6 7 public class SequenceDbTest extends AbstractDbTestCase { 8 9 public void testActivities() { 10 BpelDefinition processDefinition = new BpelDefinition(); 11 Sequence structured = new Sequence("parent"); 12 processDefinition.addNode(structured); 13 Activity first = new Empty("first"); 14 Activity second = new Empty("second"); 15 structured.addNode(first); 16 structured.addNode(second); 17 18 processDefinition = saveAndReload(processDefinition); 19 20 structured = (Sequence) processDefinition.getNode("parent"); 21 assertEquals(2, structured.getNodes().size()); 22 first = (Activity) structured.getNode("first"); 23 second = (Activity) structured.getNode("second"); 24 assertEquals(structured, first.getCompositeActivity()); 25 assertEquals(structured, second.getCompositeActivity()); 26 } 27 28 public void testDelimiters() { 29 BpelDefinition processDefinition = new BpelDefinition(); 30 Sequence structured = new Sequence("parent"); 31 processDefinition.addNode(structured); 32 33 processDefinition = saveAndReload(processDefinition); 34 35 structured = (Sequence) processDefinition.getNode("parent"); 36 Activity start = structured.getStart(); 37 Activity end = structured.getEnd(); 38 39 assertNotNull(start); 40 assertNotNull(end); 41 assertEquals(structured, start.getCompositeActivity()); 42 assertEquals(structured, end.getCompositeActivity()); 43 } 44 45 public void testConnections() { 46 BpelDefinition processDefinition = new BpelDefinition(); 47 Sequence structured = new Sequence("parent"); 48 processDefinition.addNode(structured); 49 Activity first = new Empty("first"); 50 Activity last = new Empty("second"); 51 structured.addNode(first); 52 structured.addNode(last); 53 54 processDefinition = saveAndReload(processDefinition); 55 56 structured = (Sequence) processDefinition.getNode("parent"); 57 Activity start = structured.getStart(); 58 Activity end = structured.getEnd(); 59 first = (Activity) structured.getNode("first"); 60 last = (Activity) structured.getNode("second"); 61 Transition from = (Transition) start.getLeavingTransitions().get(0); 62 Transition to = (Transition) end.getArrivingTransitions().iterator().next(); 63 64 assertEquals(from, first.getDefaultArrivingTransition()); 65 assertEquals(first.getDefaultLeavingTransition(), last.getDefaultArrivingTransition()); 66 assertEquals(to, last.getDefaultLeavingTransition()); 67 } 68 } 69 | Popular Tags |