X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FShardTransactionTest.java;h=7884eeccdae7874f8d19c9090bf08d755cc991be;hp=68cee1fcaccd91c51c18f6cfab65e45da494bc39;hb=c46e223995956f1f759c551163c212947c1e2fb7;hpb=c6618cb0df8fc41ccfcb7578b11f5ecfa0403f39 diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java index 68cee1fcac..7884eeccda 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java @@ -26,10 +26,12 @@ import org.opendaylight.controller.cluster.datastore.modification.Modification; import org.opendaylight.controller.cluster.datastore.modification.WriteModification; import org.opendaylight.controller.md.cluster.datastore.model.TestModel; import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; import org.opendaylight.yangtools.yang.model.api.SchemaContext; +import java.util.Collections; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -49,7 +51,7 @@ public class ShardTransactionTest extends AbstractActorTest { @Test public void testOnReceiveReadData() throws Exception { new JavaTestKit(getSystem()) {{ - final ActorRef shard = getSystem().actorOf(Shard.props("config")); + final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP)); final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard, testSchemaContext); final ActorRef subject = getSystem().actorOf(props, "testReadData"); @@ -58,14 +60,14 @@ public class ShardTransactionTest extends AbstractActorTest { protected void run() { subject.tell( - new ReadData(InstanceIdentifier.builder().build()).toSerializable(), + new ReadData(YangInstanceIdentifier.builder().build()).toSerializable(), 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.getClass().equals(ReadDataReply.SERIALIZABLE_CLASS)) { - if (ReadDataReply.fromSerializable(testSchemaContext,InstanceIdentifier.builder().build(), in) + if (ReadDataReply.fromSerializable(testSchemaContext,YangInstanceIdentifier.builder().build(), in) .getNormalizedNode()!= null) { return "match"; } @@ -89,7 +91,7 @@ public class ShardTransactionTest extends AbstractActorTest { @Test public void testOnReceiveReadDataWhenDataNotFound() throws Exception { new JavaTestKit(getSystem()) {{ - final ActorRef shard = getSystem().actorOf(Shard.props("config")); + final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP)); final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard, testSchemaContext); final ActorRef subject = getSystem().actorOf(props, "testReadDataWhenDataNotFound"); @@ -163,7 +165,7 @@ public class ShardTransactionTest extends AbstractActorTest { @Test public void testOnReceiveWriteData() throws Exception { new JavaTestKit(getSystem()) {{ - final ActorRef shard = getSystem().actorOf(Shard.props("config")); + final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP)); final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext()); final ActorRef subject = @@ -179,7 +181,7 @@ public class ShardTransactionTest extends AbstractActorTest { 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 WriteDataReply) { + if (in.getClass().equals(WriteDataReply.SERIALIZABLE_CLASS)) { return "match"; } else { throw noMatch(); @@ -201,7 +203,7 @@ public class ShardTransactionTest extends AbstractActorTest { @Test public void testOnReceiveMergeData() throws Exception { new JavaTestKit(getSystem()) {{ - final ActorRef shard = getSystem().actorOf(Shard.props("config")); + final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP)); final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard, testSchemaContext); final ActorRef subject = @@ -217,7 +219,7 @@ public class ShardTransactionTest extends AbstractActorTest { final String out = new ExpectMsg(duration("500 milliseconds"), "match hint") { // do not put code outside this method, will run afterwards protected String match(Object in) { - if (in instanceof MergeDataReply) { + if (in.getClass().equals(MergeDataReply.SERIALIZABLE_CLASS)) { return "match"; } else { throw noMatch(); @@ -240,7 +242,7 @@ public class ShardTransactionTest extends AbstractActorTest { @Test public void testOnReceiveDeleteData() throws Exception { new JavaTestKit(getSystem()) {{ - final ActorRef shard = getSystem().actorOf(Shard.props("config")); + final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP)); final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext()); final ActorRef subject = @@ -254,7 +256,7 @@ public class ShardTransactionTest extends AbstractActorTest { 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 DeleteDataReply) { + if (in.getClass().equals(DeleteDataReply.SERIALIZABLE_CLASS)) { return "match"; } else { throw noMatch(); @@ -277,7 +279,7 @@ public class ShardTransactionTest extends AbstractActorTest { @Test public void testOnReceiveReadyTransaction() throws Exception { new JavaTestKit(getSystem()) {{ - final ActorRef shard = getSystem().actorOf(Shard.props("config")); + final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP)); final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext()); final ActorRef subject = @@ -286,12 +288,12 @@ public class ShardTransactionTest extends AbstractActorTest { new Within(duration("1 seconds")) { protected void run() { - subject.tell(new ReadyTransaction(), getRef()); + subject.tell(new ReadyTransaction().toSerializable(), 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 ReadyTransactionReply) { + if (in.getClass().equals(ReadyTransactionReply.SERIALIZABLE_CLASS)) { return "match"; } else { throw noMatch(); @@ -313,7 +315,7 @@ public class ShardTransactionTest extends AbstractActorTest { @Test public void testOnReceiveCloseTransaction() throws Exception { new JavaTestKit(getSystem()) {{ - final ActorRef shard = getSystem().actorOf(Shard.props("config")); + final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP)); final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext()); final ActorRef subject = @@ -324,12 +326,12 @@ public class ShardTransactionTest extends AbstractActorTest { new Within(duration("2 seconds")) { protected void run() { - subject.tell(new CloseTransaction(), getRef()); + subject.tell(new CloseTransaction().toSerializable(), 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 CloseTransactionReply) { + if (in.getClass().equals(CloseTransactionReply.SERIALIZABLE_CLASS)) { return "match"; } else { throw noMatch();