KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jbpm > bpel > exe > state > CompExplicitHandlerTest


1 package org.jbpm.bpel.exe.state;
2
3
4 /**
5  * @author Juan Cantu
6  * @version $Revision: 1.3 $ $Date: 2005/06/16 19:15:34 $
7  */

8 public class CompExplicitHandlerTest extends AbstractStateTestCase {
9   
10   public ScopeState getState() {
11     return CompensatingState.COMPENSATING_EXPLICITLY;
12   }
13
14   public void testFaulted() {
15     scope.faulted(null);
16     assertEquals(CompensatingState.TERMINATING_CHILDREN_AT_HANDLER, scope.getState());
17     assertChildrenTerminated();
18   }
19   
20   public void testFaultedAtScope() {
21     TestInstance parent = createTestScope(root);
22     
23     scope.faulted(null);
24     assertEquals(CompensatingState.TERMINATING_CHILDREN_AT_HANDLER, scope.getState());
25     assertChildrenTerminated();
26     assertFalse(parent.childFaulted);
27   }
28   
29   public void testCompleted() {
30     scope.completed();
31     
32     assertEquals( EndedState.COMPENSATED, scope.getState() );
33   }
34   
35   public void testCompletedAtScope() {
36     TestInstance parent = createTestScope(root);
37     scope.completed();
38     
39     assertEquals( EndedState.COMPENSATED, scope.getState() );
40     assertTrue( parent.childCompensated );
41   }
42   
43   public void testChildrenCompensated() {
44     try { ((HandlingState)scope.getState()).childrenCompensated(scope); }
45     catch(IllegalStateException JavaDoc e) { return; }
46     fail("childrenCompensated can't be invoked at this state");
47   }
48 }
49
Popular Tags