added integration tests
This commit is contained in:
parent
163c0287e2
commit
efcd736f94
5 changed files with 113 additions and 0 deletions
|
|
@ -0,0 +1,10 @@
|
|||
package se.scalablesolutions.akka.spring.foo;
|
||||
|
||||
public class Bar implements IBar {
|
||||
|
||||
@Override
|
||||
public String getBar() {
|
||||
return "bar";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package se.scalablesolutions.akka.spring.foo;
|
||||
|
||||
public class Foo {
|
||||
|
||||
public String foo() {
|
||||
return "foo";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package se.scalablesolutions.akka.spring.foo;
|
||||
|
||||
public interface IBar {
|
||||
|
||||
String getBar();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package se.scalablesolutions.akka.spring.foo;
|
||||
|
||||
public class MyPojo {
|
||||
|
||||
private String foo;
|
||||
private String bar;
|
||||
|
||||
|
||||
public MyPojo() {
|
||||
this.foo = "foo";
|
||||
this.bar = "bar";
|
||||
}
|
||||
|
||||
|
||||
public String getFoo() {
|
||||
return foo;
|
||||
}
|
||||
|
||||
|
||||
public String getBar() {
|
||||
return bar;
|
||||
}
|
||||
|
||||
public void preRestart() {
|
||||
System.out.println("pre restart");
|
||||
}
|
||||
|
||||
public void postRestart() {
|
||||
System.out.println("post restart");
|
||||
}
|
||||
|
||||
public String longRunning() {
|
||||
try {
|
||||
Thread.sleep(6000);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
return "this took long";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package se.scalablesolutions.akka.spring.foo;
|
||||
|
||||
import se.scalablesolutions.akka.stm.TransactionalMap;
|
||||
import se.scalablesolutions.akka.stm.TransactionalVector;
|
||||
import se.scalablesolutions.akka.stm.TransactionalRef;
|
||||
import se.scalablesolutions.akka.stm.TransactionalState;
|
||||
|
||||
public class StatefulPojo {
|
||||
private TransactionalMap<String, String> mapState;
|
||||
private TransactionalVector<String> vectorState;
|
||||
private TransactionalRef<String> refState;
|
||||
private boolean isInitialized = false;
|
||||
|
||||
public void init() {
|
||||
if (!isInitialized) {
|
||||
mapState = TransactionalState.newMap();
|
||||
vectorState = TransactionalState.newVector();
|
||||
refState = TransactionalState.newRef();
|
||||
isInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
public String getMapState(String key) {
|
||||
return (String)mapState.get(key).get();
|
||||
}
|
||||
|
||||
public String getVectorState() {
|
||||
return (String)vectorState.last();
|
||||
}
|
||||
|
||||
public String getRefState() {
|
||||
return (String)refState.get().get();
|
||||
}
|
||||
|
||||
public void setMapState(String key, String msg) {
|
||||
mapState.put(key, msg);
|
||||
}
|
||||
|
||||
public void setVectorState(String msg) {
|
||||
vectorState.add(msg);
|
||||
}
|
||||
|
||||
public void setRefState(String msg) {
|
||||
refState.swap(msg);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue