Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "Custom mailbox that is bounded and instrumented."
[controller.git]
/
opendaylight
/
md-sal
/
sal-distributed-datastore
/
src
/
test
/
java
/
org
/
opendaylight
/
controller
/
cluster
/
datastore
/
ShardTransactionChainTest.java
diff --git
a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionChainTest.java
b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionChainTest.java
index bc3a1046566b2259012916c85e70ae933d921b3d..d468af6664981d08ad603b1a841fefbdaccc8d47 100644
(file)
--- a/
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionChainTest.java
+++ b/
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionChainTest.java
@@
-14,13
+14,13
@@
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
import static org.junit.Assert.assertEquals;
import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
public class ShardTransactionChainTest extends AbstractActorTest {
private static ListeningExecutorService storeExecutor = MoreExecutors.listeningDecorator(MoreExecutors.sameThreadExecutor());
public class ShardTransactionChainTest extends AbstractActorTest {
private static ListeningExecutorService storeExecutor = MoreExecutors.listeningDecorator(MoreExecutors.sameThreadExecutor());
- private static final InMemoryDOMDataStore store = new InMemoryDOMDataStore("OPER", storeExecutor);
+ private static final InMemoryDOMDataStore store = new InMemoryDOMDataStore("OPER", storeExecutor,
+ MoreExecutors.sameThreadExecutor());
static {
store.onGlobalContextUpdated(TestModel.createTestContext());
static {
store.onGlobalContextUpdated(TestModel.createTestContext());
@@
-28,26
+28,31
@@
public class ShardTransactionChainTest extends AbstractActorTest {
@Test
public void testOnReceiveCreateTransaction() throws Exception {
new JavaTestKit(getSystem()) {{
@Test
public void testOnReceiveCreateTransaction() throws Exception {
new JavaTestKit(getSystem()) {{
- final Props props = ShardTransactionChain.props(store.createTransactionChain());
+ final Props props = ShardTransactionChain.props(store.createTransactionChain()
, TestModel.createTestContext()
);
final ActorRef subject = getSystem().actorOf(props, "testCreateTransaction");
final ActorRef subject = getSystem().actorOf(props, "testCreateTransaction");
- new Within(duration("1 seconds")) {
+ new Within(duration("1 seconds")) {
+ @Override
protected void run() {
protected void run() {
- subject.tell(new CreateTransaction(), getRef());
+ subject.tell(new CreateTransaction(
"txn-1", TransactionProxy.TransactionType.READ_ONLY.ordinal() ).toSerializable(
), getRef());
- final String out = new ExpectMsg<String>("match hint") {
+ final String out = new ExpectMsg<String>(
duration("1 seconds"),
"match hint") {
// do not put code outside this method, will run afterwards
// do not put code outside this method, will run afterwards
+ @Override
protected String match(Object in) {
protected String match(Object in) {
- if (in
instanceof CreateTransactionReply
) {
- return
((CreateTransactionReply) in).getTransactionPath().toString
();
- }
else
{
+ if (in
.getClass().equals(CreateTransactionReply.SERIALIZABLE_CLASS)
) {
+ return
CreateTransactionReply.fromSerializable(in).getTransactionPath
();
+ }
else
{
throw noMatch();
}
}
}.get(); // this extracts the received message
throw noMatch();
}
}
}.get(); // this extracts the received message
- assertTrue(out.matches("akka:\\/\\/test\\/user\\/testCreateTransaction\\/\\$.*"));
+ assertEquals("Unexpected transaction path " + out,
+ "akka://test/user/testCreateTransaction/shard-txn-1",
+ out);
+
// Will wait for the rest of the 3 seconds
expectNoMsg();
}
// Will wait for the rest of the 3 seconds
expectNoMsg();
}
@@
-60,18
+65,20
@@
public class ShardTransactionChainTest extends AbstractActorTest {
@Test
public void testOnReceiveCloseTransactionChain() throws Exception {
new JavaTestKit(getSystem()) {{
@Test
public void testOnReceiveCloseTransactionChain() throws Exception {
new JavaTestKit(getSystem()) {{
- final Props props = ShardTransactionChain.props(store.createTransactionChain());
+ final Props props = ShardTransactionChain.props(store.createTransactionChain()
, TestModel.createTestContext()
);
final ActorRef subject = getSystem().actorOf(props, "testCloseTransactionChain");
new Within(duration("1 seconds")) {
final ActorRef subject = getSystem().actorOf(props, "testCloseTransactionChain");
new Within(duration("1 seconds")) {
+ @Override
protected void run() {
protected void run() {
- subject.tell(new CloseTransactionChain(), getRef());
+ subject.tell(new CloseTransactionChain()
.toSerializable()
, getRef());
- final String out = new ExpectMsg<String>("match hint") {
+ final String out = new ExpectMsg<String>(
duration("1 seconds"),
"match hint") {
// do not put code outside this method, will run afterwards
// do not put code outside this method, will run afterwards
+ @Override
protected String match(Object in) {
protected String match(Object in) {
- if (in
instanceof CloseTransactionChainReply
) {
+ if (in
.getClass().equals(CloseTransactionChainReply.SERIALIZABLE_CLASS)
) {
return "match";
} else {
throw noMatch();
return "match";
} else {
throw noMatch();
@@
-88,4
+95,4
@@
public class ShardTransactionChainTest extends AbstractActorTest {
};
}};
}
};
}};
}
-}
\ No newline at end of file
+}