KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.jbpm.bpel.exe.state;
2
3 import org.jbpm.bpel.def.Scope;
4 import org.jbpm.bpel.def.ScopeHandler;
5
6 /**
7  * @author Juan Cantu
8  * @version $Revision: 1.3 $ $Date: 2005/06/03 00:13:41 $
9  */

10 public class TermChildrenTest extends AbstractStateTestCase {
11
12   public ScopeState getState() {
13     return TerminatingState.TERMINATING_CHILDREN;
14   }
15
16   public void testChildrenTerminated() {
17     scope.getState().childrenTerminated(scope);
18     assertEquals( TerminatingState.TERMINATING_IMPLICITLY, scope.getState() );
19   }
20   
21   public void testChildrenTerminatedWithHandler() {
22     ScopeHandler hdlr = new ScopeHandler();
23     hdlr.setActivity(handlerLog);
24     pd.getScope().setHandler(Scope.TERMINATION, hdlr);
25     
26     scope.getState().childrenTerminated(scope);
27     assertEquals( TerminatingState.TERMINATING_EXPLICITLY, scope.getState() );
28     assertTrue(handlerLog.executed);
29   }
30   
31   public void testFaulted() {
32     scope.faulted(null);
33     assertEquals(TerminatingState.TERMINATING_CHILDREN, scope.getState());
34   }
35   
36   public void testChildrenCompensated() {
37     try { ((HandlingState)scope.getState()).childrenCompensated(scope); }
38     catch(IllegalStateException JavaDoc e) { return; }
39     fail("childrenCompensated can't be invoked at this state");
40   }
41 }
42
Popular Tags