KickJava   Java API By Example, From Geeks To Geeks.

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


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:35 $
7  */

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