1 package org.jbpm.bpel.xml; 2 3 import org.jbpm.bpel.def.Compensate; 4 import org.jbpm.bpel.def.Scope; 5 import org.jbpm.bpel.def.ScopeHandler; 6 import org.jbpm.bpel.def.Sequence; 7 8 12 public class CompensateReaderTest extends AbstractReaderTestCase { 13 14 public void testScope() throws Exception { 15 Scope aScope = new Scope("aScope"); 16 scope.addNode(aScope); 17 ScopeHandler handler = new ScopeHandler(); 18 scope.setHandler(Scope.COMPENSATION, handler); 19 20 21 String xml = "<compensate scope='aScope'/>"; 22 Compensate compensate = 23 (Compensate) readActivity(parseAsBpelElement(xml), handler); 24 25 assertEquals( aScope , compensate.getScope()); 26 } 27 28 public void testNestedScope() throws Exception { 29 Sequence sequence = new Sequence("aSequence"); 30 Scope aScope = new Scope("aScope"); 31 sequence.addNode(aScope); 32 scope.addNode(sequence); 33 ScopeHandler handler = new ScopeHandler(); 34 scope.setHandler(Scope.COMPENSATION, handler); 35 36 String xml = "<compensate scope='aScope'/>"; 37 Compensate compensate = 38 (Compensate) readActivity(parseAsBpelElement(xml), handler); 39 40 assertEquals( aScope , compensate.getScope()); 41 } 42 43 public void testScopeDefault() throws Exception { 44 String xml = "<compensate/>"; 45 Compensate compensate = (Compensate) readActivity(xml); 46 assertEquals( scope , compensate.getScope()); 47 } 48 } 49 | Popular Tags |