fixed most remaining failing tests for persistence

This commit is contained in:
Jonas Boner 2009-07-03 17:53:33 +02:00
parent 011aee43d2
commit 800f3bc917
7 changed files with 326 additions and 171 deletions

View file

@ -70,8 +70,8 @@ public class PersistentNestedStateTest extends TestCase {
PersistentStatefulNested nested = conf.getActiveObject(PersistentStatefulNested.class);
nested.setVectorState("init"); // set init state
stateful.success("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state", nested); // transactionrequired
assertEquals("new state", stateful.getVectorState(0));
assertEquals("new state", nested.getVectorState(0));
assertEquals(3, stateful.getVectorLength()); // BAD: keeps one element since last test
assertEquals(3, nested.getVectorLength());
}
public void testVectorShouldRollbackStateForStatefulServerInCaseOfFailure() {
@ -85,8 +85,8 @@ public class PersistentNestedStateTest extends TestCase {
fail("should have thrown an exception");
} catch (RuntimeException e) {
} // expected
assertEquals("init", stateful.getVectorState(0)); // check that state is == init state
assertEquals("init", nested.getVectorState(0)); // check that state is == init state
assertEquals(1, stateful.getVectorLength());
assertEquals(1, nested.getVectorLength());
}
public void testRefShouldNotRollbackStateForStatefulServerInCaseOfSuccess() {

View file

@ -20,7 +20,10 @@ public class PersistentStateful {
return (String) vectorState.get(index);
}
public int getVectorLength() {
return vectorState.length();
}
public String getRefState() {
if (refState.isDefined()) {
return (String) refState.get().get();

View file

@ -20,6 +20,9 @@ public class PersistentStatefulNested {
return (String) vectorState.get(index);
}
public int getVectorLength() {
return vectorState.length();
}
public String getRefState() {
if (refState.isDefined()) {