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=abea7852111f6a9397777b496d85384d2c06ef3e;hp=2d9ae93d9ee1d044b2809996b88d1183c16672f8;hb=12a178609f39e8c73856fc640813cfda9f058167;hpb=79202e1fd05d2606b35e163f608fad9cce84b5d4 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 2d9ae93d9e..abea785211 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 @@ -28,6 +28,7 @@ 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.impl.schema.ImmutableNodes; +import org.opendaylight.yangtools.yang.model.api.SchemaContext; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -39,8 +40,10 @@ public class ShardTransactionTest extends AbstractActorTest { private static final InMemoryDOMDataStore store = new InMemoryDOMDataStore("OPER", storeExecutor); + private static final SchemaContext testSchemaContext = TestModel.createTestContext(); + static { - store.onGlobalContextUpdated(TestModel.createTestContext()); + store.onGlobalContextUpdated(testSchemaContext); } @Test @@ -48,7 +51,7 @@ public class ShardTransactionTest extends AbstractActorTest { new JavaTestKit(getSystem()) {{ final ActorRef shard = getSystem().actorOf(Shard.props("config")); final Props props = - ShardTransaction.props(store.newReadWriteTransaction(), shard); + ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext()); final ActorRef subject = getSystem().actorOf(props, "testReadData"); new Within(duration("1 seconds")) { @@ -88,7 +91,7 @@ public class ShardTransactionTest extends AbstractActorTest { new JavaTestKit(getSystem()) {{ final ActorRef shard = getSystem().actorOf(Shard.props("config")); final Props props = - ShardTransaction.props(store.newReadWriteTransaction(), shard); + ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext()); final ActorRef subject = getSystem().actorOf(props, "testReadDataWhenDataNotFound"); new Within(duration("1 seconds")) { @@ -161,7 +164,7 @@ public class ShardTransactionTest extends AbstractActorTest { new JavaTestKit(getSystem()) {{ final ActorRef shard = getSystem().actorOf(Shard.props("config")); final Props props = - ShardTransaction.props(store.newReadWriteTransaction(), shard); + ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext()); final ActorRef subject = getSystem().actorOf(props, "testWriteData"); @@ -169,7 +172,7 @@ public class ShardTransactionTest extends AbstractActorTest { protected void run() { subject.tell(new WriteData(TestModel.TEST_PATH, - ImmutableNodes.containerNode(TestModel.TEST_QNAME)), + ImmutableNodes.containerNode(TestModel.TEST_QNAME), TestModel.createTestContext()).toSerializable(), getRef()); final String out = new ExpectMsg("match hint") { @@ -199,7 +202,7 @@ public class ShardTransactionTest extends AbstractActorTest { new JavaTestKit(getSystem()) {{ final ActorRef shard = getSystem().actorOf(Shard.props("config")); final Props props = - ShardTransaction.props(store.newReadWriteTransaction(), shard); + ShardTransaction.props(store.newReadWriteTransaction(), shard, testSchemaContext); final ActorRef subject = getSystem().actorOf(props, "testMergeData"); @@ -207,10 +210,10 @@ public class ShardTransactionTest extends AbstractActorTest { protected void run() { subject.tell(new MergeData(TestModel.TEST_PATH, - ImmutableNodes.containerNode(TestModel.TEST_QNAME)), + ImmutableNodes.containerNode(TestModel.TEST_QNAME), testSchemaContext).toSerializable(), getRef()); - final String out = new ExpectMsg("match hint") { + 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) { @@ -238,14 +241,14 @@ public class ShardTransactionTest extends AbstractActorTest { new JavaTestKit(getSystem()) {{ final ActorRef shard = getSystem().actorOf(Shard.props("config")); final Props props = - ShardTransaction.props(store.newReadWriteTransaction(), shard); + ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext()); final ActorRef subject = getSystem().actorOf(props, "testDeleteData"); new Within(duration("1 seconds")) { protected void run() { - subject.tell(new DeleteData(TestModel.TEST_PATH), getRef()); + subject.tell(new DeleteData(TestModel.TEST_PATH).toSerializable(), getRef()); final String out = new ExpectMsg("match hint") { // do not put code outside this method, will run afterwards @@ -275,7 +278,7 @@ public class ShardTransactionTest extends AbstractActorTest { new JavaTestKit(getSystem()) {{ final ActorRef shard = getSystem().actorOf(Shard.props("config")); final Props props = - ShardTransaction.props(store.newReadWriteTransaction(), shard); + ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext()); final ActorRef subject = getSystem().actorOf(props, "testReadyTransaction"); @@ -311,7 +314,7 @@ public class ShardTransactionTest extends AbstractActorTest { new JavaTestKit(getSystem()) {{ final ActorRef shard = getSystem().actorOf(Shard.props("config")); final Props props = - ShardTransaction.props(store.newReadWriteTransaction(), shard); + ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext()); final ActorRef subject = getSystem().actorOf(props, "testCloseTransaction");