KickJava   Java API By Example, From Geeks To Geeks.

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


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 CompletedTest extends AbstractStateTestCase {
11
12   public ScopeState getState() {
13     return EndedState.COMPLETED;
14   }
15   
16   public void testCompensate() {
17     scope.compensate();
18     
19     assertFalse( handlerLog.executed );
20     assertChildrenCompensated();
21     assertEquals( CompensatingState.COMPENSATING_IMPLICITLY, scope.getState() );
22   }
23   
24   public void testCompensateWithHandler() {
25     ScopeHandler hdlr = new ScopeHandler();
26     hdlr.setActivity(handlerLog);
27     pd.getScope().setHandler(Scope.COMPENSATION, hdlr);
28     
29     scope.compensate();
30     assertTrue( handlerLog.executed );
31     assertEquals( CompensatingState.COMPENSATING_EXPLICITLY, scope.getState() );
32   }
33   
34 }
35
Popular Tags