X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FShardTransactionChainTest.java;h=1e681795cad92ce04d0181f2790f59e99e905c32;hb=af255d4824ce1290d6e6b4c669a5d9b0c5960f34;hp=bc3a1046566b2259012916c85e70ae933d921b3d;hpb=ca6ab9d397168973410b87c21f3a8f82ea871a8e;p=controller.git 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 bc3a104656..1e681795ca 100644 --- 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 @@ -9,12 +9,11 @@ import org.junit.Test; import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionChain; import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionChainReply; import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction; -import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply; +import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply; 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 static org.junit.Assert.assertTrue; public class ShardTransactionChainTest extends AbstractActorTest { @@ -28,27 +27,30 @@ public class ShardTransactionChainTest extends AbstractActorTest { @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"); new Within(duration("1 seconds")) { protected void run() { - subject.tell(new CreateTransaction(), getRef()); + subject.tell(new CreateTransaction("txn-1"), getRef()); final String out = new ExpectMsg("match hint") { // do not put code outside this method, will run afterwards protected String match(Object in) { if (in instanceof CreateTransactionReply) { - return ((CreateTransactionReply) in).getTransactionPath().toString(); + return ((CreateTransactionReply) in).getTransactionActorPath().toString(); } else { throw noMatch(); } } }.get(); // this extracts the received message - assertTrue(out.matches("akka:\\/\\/test\\/user\\/testCreateTransaction\\/\\$.*")); - // Will wait for the rest of the 3 seconds + assertEquals("Unexpected transaction path " + out, + "akka://test/user/testCreateTransaction/shard-txn-1", + out); + + // Will wait for the rest of the 3 seconds expectNoMsg(); } @@ -60,7 +62,7 @@ public class ShardTransactionChainTest extends AbstractActorTest { @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")) { @@ -88,4 +90,4 @@ public class ShardTransactionChainTest extends AbstractActorTest { }; }}; } -} \ No newline at end of file +}