예제 #1
0
 public void testVectorShouldRollbackStateForStatefulServerInCaseOfFailure() {
   InMemStateful stateful = conf.getInstance(InMemStateful.class);
   stateful.setVectorState("init"); // set init state
   InMemFailer failer = conf.getInstance(InMemFailer.class);
   try {
     stateful.failure(
         "testShouldRollbackStateForStatefulServerInCaseOfFailure",
         "new state",
         failer); // call failing transactionrequired method
     fail("should have thrown an exception");
   } catch (RuntimeException e) {
   } // expected
   assertEquals("init", stateful.getVectorState()); // check that state is == init state
 }
예제 #2
0
 public void testRefShouldNotRollbackStateForStatefulServerInCaseOfSuccess() {
   InMemStateful stateful = conf.getInstance(InMemStateful.class);
   stateful.setRefState("init"); // set init state
   stateful.success(
       "testShouldNotRollbackStateForStatefulServerInCaseOfSuccess",
       "new state"); // transactionrequired
   assertEquals("new state", stateful.getRefState());
 }
예제 #3
0
 protected void setUp() {
   Config.config();
   conf.configure(
           new RestartStrategy(new AllForOne(), 3, 5000),
           new Component[] {
             new Component(
                 InMemStateful.class,
                 new LifeCycle(new Permanent()),
                 // new RestartCallbacks("preRestart", "postRestart")),
                 10000),
             new Component(InMemFailer.class, new LifeCycle(new Permanent()), 10000)
           })
       .inject()
       .supervise();
   InMemStateful stateful = conf.getInstance(InMemStateful.class);
   stateful.init();
 }