added init tx state hook for active objects, rewrote mongodb test
This commit is contained in:
parent
1bce709c5d
commit
98bdd9370d
17 changed files with 538 additions and 593 deletions
|
|
@ -9,11 +9,11 @@ public class AllTest extends TestCase {
|
|||
TestSuite suite = new TestSuite("All Java tests");
|
||||
suite.addTestSuite(InMemoryStateTest.class);
|
||||
suite.addTestSuite(InMemNestedStateTest.class);
|
||||
suite.addTestSuite(RemoteInMemoryStateTest.class);
|
||||
suite.addTestSuite(ActiveObjectGuiceConfiguratorTest.class);
|
||||
//suite.addTestSuite(PersistentStateTest.class);
|
||||
//suite.addTestSuite(PersistentNestedStateTest.class);
|
||||
suite.addTestSuite(RemoteInMemoryStateTest.class);
|
||||
//suite.addTestSuite(RemotePersistentStateTest.class);
|
||||
suite.addTestSuite(ActiveObjectGuiceConfiguratorTest.class);
|
||||
//suite.addTestSuite(RestTest.class);
|
||||
return suite;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,15 +3,22 @@ package se.scalablesolutions.akka.api;
|
|||
import se.scalablesolutions.akka.annotation.transactionrequired;
|
||||
import se.scalablesolutions.akka.annotation.prerestart;
|
||||
import se.scalablesolutions.akka.annotation.postrestart;
|
||||
import se.scalablesolutions.akka.annotation.inittransactionalstate;
|
||||
import se.scalablesolutions.akka.state.*;
|
||||
|
||||
@transactionrequired
|
||||
public class InMemStateful {
|
||||
private TransactionalState factory = new TransactionalState();
|
||||
private TransactionalMap<String, String> mapState = factory.newMap();
|
||||
private TransactionalVector<String> vectorState = factory.newVector();
|
||||
private TransactionalRef<String> refState = factory.newRef();
|
||||
private TransactionalMap<String, String> mapState;
|
||||
private TransactionalVector<String> vectorState;
|
||||
private TransactionalRef<String> refState;
|
||||
|
||||
@inittransactionalstate
|
||||
public void init() {
|
||||
mapState = TransactionalState.newMap();
|
||||
vectorState = TransactionalState.newVector();
|
||||
refState = TransactionalState.newRef();
|
||||
}
|
||||
|
||||
public String getMapState(String key) {
|
||||
return (String)mapState.get(key).get();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,21 @@
|
|||
package se.scalablesolutions.akka.api;
|
||||
|
||||
import se.scalablesolutions.akka.annotation.transactionrequired;
|
||||
import se.scalablesolutions.akka.annotation.inittransactionalstate;
|
||||
import se.scalablesolutions.akka.state.*;
|
||||
|
||||
@transactionrequired
|
||||
public class InMemStatefulNested {
|
||||
private TransactionalState factory = new TransactionalState();
|
||||
private TransactionalMap<String, String> mapState = factory.newMap();
|
||||
private TransactionalVector<String> vectorState = factory.newVector();
|
||||
private TransactionalRef<String> refState = factory.newRef();
|
||||
private TransactionalMap<String, String> mapState;
|
||||
private TransactionalVector<String> vectorState;
|
||||
private TransactionalRef<String> refState;
|
||||
|
||||
@inittransactionalstate
|
||||
public void init() {
|
||||
mapState = TransactionalState.newMap();
|
||||
vectorState = TransactionalState.newVector();
|
||||
refState = TransactionalState.newRef();
|
||||
}
|
||||
|
||||
public String getMapState(String key) {
|
||||
return (String)mapState.get(key).get();
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ public class InMemoryStateTest extends TestCase {
|
|||
}
|
||||
|
||||
protected void tearDown() {
|
||||
conf.stop();
|
||||
}
|
||||
conf.stop();
|
||||
}
|
||||
|
||||
public void testMapShouldNotRollbackStateForStatefulServerInCaseOfSuccess() {
|
||||
InMemStateful stateful = conf.getInstance(InMemStateful.class);
|
||||
|
|
|
|||
|
|
@ -1,11 +1,16 @@
|
|||
package se.scalablesolutions.akka.api;
|
||||
|
||||
import se.scalablesolutions.akka.state.*;
|
||||
import se.scalablesolutions.akka.annotation.inittransactionalstate;
|
||||
|
||||
public class PersistentClasher {
|
||||
private PersistentState factory = new PersistentState();
|
||||
private PersistentMap state = factory.newMap(new CassandraStorageConfig());
|
||||
private PersistentMap state;
|
||||
|
||||
@inittransactionalstate
|
||||
public void init() {
|
||||
state = PersistentState.newMap(new CassandraStorageConfig());
|
||||
}
|
||||
|
||||
public String getState(String key) {
|
||||
return (String)state.get(key).get();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,22 @@
|
|||
package se.scalablesolutions.akka.api;
|
||||
|
||||
import se.scalablesolutions.akka.annotation.inittransactionalstate;
|
||||
import se.scalablesolutions.akka.annotation.transactionrequired;
|
||||
import se.scalablesolutions.akka.state.*;
|
||||
|
||||
@transactionrequired
|
||||
public class PersistentStateful {
|
||||
private PersistentState factory = new PersistentState();
|
||||
private PersistentMap mapState = factory.newMap(new CassandraStorageConfig());
|
||||
private PersistentVector vectorState = factory.newVector(new CassandraStorageConfig());;
|
||||
private PersistentRef refState = factory.newRef(new CassandraStorageConfig());
|
||||
private PersistentMap mapState;
|
||||
private PersistentVector vectorState;
|
||||
private PersistentRef refState;
|
||||
|
||||
|
||||
@inittransactionalstate
|
||||
public void init() {
|
||||
mapState = PersistentState.newMap(new CassandraStorageConfig());
|
||||
vectorState = PersistentState.newVector(new CassandraStorageConfig());
|
||||
refState = PersistentState.newRef(new CassandraStorageConfig());
|
||||
}
|
||||
|
||||
public String getMapState(String key) {
|
||||
return (String) mapState.get(key).get();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,21 @@
|
|||
package se.scalablesolutions.akka.api;
|
||||
|
||||
import se.scalablesolutions.akka.annotation.inittransactionalstate;
|
||||
import se.scalablesolutions.akka.annotation.transactionrequired;
|
||||
import se.scalablesolutions.akka.state.*;
|
||||
|
||||
@transactionrequired
|
||||
public class PersistentStatefulNested {
|
||||
private PersistentState factory = new PersistentState();
|
||||
private PersistentMap mapState = factory.newMap(new CassandraStorageConfig());
|
||||
private PersistentVector vectorState = factory.newVector(new CassandraStorageConfig());;
|
||||
private PersistentRef refState = factory.newRef(new CassandraStorageConfig());
|
||||
private PersistentMap mapState;
|
||||
private PersistentVector vectorState;
|
||||
private PersistentRef refState;
|
||||
|
||||
@inittransactionalstate
|
||||
public void init() {
|
||||
mapState = PersistentState.newMap(new CassandraStorageConfig());
|
||||
vectorState = PersistentState.newVector(new CassandraStorageConfig());
|
||||
refState = PersistentState.newRef(new CassandraStorageConfig());
|
||||
}
|
||||
|
||||
public String getMapState(String key) {
|
||||
return (String) mapState.get(key).get();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue