KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jbpm > bpel > xml > CompensateReaderTest


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 /**
9  * @author Juan Cantú
10  * @version $Revision: 1.4 $ $Date: 2005/06/16 19:15:35 $
11  */

12 public class CompensateReaderTest extends AbstractReaderTestCase {
13   
14   public void testScope() throws Exception JavaDoc {
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 JavaDoc 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 JavaDoc {
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 JavaDoc 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 JavaDoc {
44     String JavaDoc xml = "<compensate/>";
45     Compensate compensate = (Compensate) readActivity(xml);
46     assertEquals( scope , compensate.getScope());
47   }
48 }
49
Popular Tags