コード例 #1
0
ファイル: InMemoryStateTest.java プロジェクト: masseyis/akka
 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
ファイル: InMemoryStateTest.java プロジェクト: masseyis/akka
 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
ファイル: InMemoryStateTest.java プロジェクト: masseyis/akka
 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();
 }
コード例 #4
0
ファイル: InMemoryStateTest.java プロジェクト: masseyis/akka
 protected void tearDown() {
   conf.stop();
 }