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%2FShardManagerTest.java;h=02201f7cd1672d2c8d02415ae4d65d8b71432f8e;hb=70c27e8bf6d323376a78aa5468faf4f27d081638;hp=e6f68c032a325f59bea291e2f17e129fd47da766;hpb=945a63ae76181f7cda4b052fa8fcdf115da4cf2d;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardManagerTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardManagerTest.java index e6f68c032a..02201f7cd1 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardManagerTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardManagerTest.java @@ -15,8 +15,10 @@ import org.opendaylight.controller.cluster.datastore.messages.LocalShardFound; import org.opendaylight.controller.cluster.datastore.messages.LocalShardNotFound; import org.opendaylight.controller.cluster.datastore.messages.PrimaryFound; import org.opendaylight.controller.cluster.datastore.messages.PrimaryNotFound; +import org.opendaylight.controller.cluster.datastore.messages.UpdateSchemaContext; import org.opendaylight.controller.cluster.datastore.utils.MockClusterWrapper; import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration; +import org.opendaylight.controller.md.cluster.datastore.model.TestModel; import scala.concurrent.duration.Duration; import static junit.framework.Assert.assertEquals; @@ -42,11 +44,11 @@ public class ShardManagerTest { new JavaTestKit(system) {{ final Props props = ShardManager .props("config", new MockClusterWrapper(), - new MockConfiguration(), new ShardContext()); + new MockConfiguration(), new DatastoreContext()); final TestActorRef subject = TestActorRef.create(system, props); - new Within(duration("1 seconds")) { + new Within(duration("10 seconds")) { @Override protected void run() { @@ -67,11 +69,13 @@ public class ShardManagerTest { new JavaTestKit(system) {{ final Props props = ShardManager .props("config", new MockClusterWrapper(), - new MockConfiguration(), new ShardContext()); + new MockConfiguration(), new DatastoreContext()); final TestActorRef subject = TestActorRef.create(system, props); - new Within(duration("1 seconds")) { + subject.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef()); + + new Within(duration("10 seconds")) { @Override protected void run() { @@ -91,17 +95,17 @@ public class ShardManagerTest { new JavaTestKit(system) {{ final Props props = ShardManager .props("config", new MockClusterWrapper(), - new MockConfiguration(), new ShardContext()); + new MockConfiguration(), new DatastoreContext()); final TestActorRef subject = TestActorRef.create(system, props); - new Within(duration("1 seconds")) { + new Within(duration("10 seconds")) { @Override protected void run() { subject.tell(new FindLocalShard("inventory"), getRef()); - final String out = new ExpectMsg(duration("1 seconds"), "find local") { + final String out = new ExpectMsg(duration("10 seconds"), "find local") { @Override protected String match(Object in) { if (in instanceof LocalShardNotFound) { @@ -128,17 +132,19 @@ public class ShardManagerTest { new JavaTestKit(system) {{ final Props props = ShardManager .props("config", mockClusterWrapper, - new MockConfiguration(), new ShardContext()); + new MockConfiguration(), new DatastoreContext()); final TestActorRef subject = TestActorRef.create(system, props); - new Within(duration("1 seconds")) { + subject.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef()); + + new Within(duration("10 seconds")) { @Override protected void run() { subject.tell(new FindLocalShard(Shard.DEFAULT_NAME), getRef()); - final ActorRef out = new ExpectMsg(duration("1 seconds"), "find local") { + final ActorRef out = new ExpectMsg(duration("10 seconds"), "find local") { @Override protected ActorRef match(Object in) { if (in instanceof LocalShardFound) { @@ -164,12 +170,12 @@ public class ShardManagerTest { new JavaTestKit(system) {{ final Props props = ShardManager .props("config", new MockClusterWrapper(), - new MockConfiguration(), new ShardContext()); + new MockConfiguration(), new DatastoreContext()); final TestActorRef subject = TestActorRef.create(system, props); // the run() method needs to finish within 3 seconds - new Within(duration("1 seconds")) { + new Within(duration("10 seconds")) { @Override protected void run() { @@ -204,12 +210,12 @@ public class ShardManagerTest { new JavaTestKit(system) {{ final Props props = ShardManager .props("config", new MockClusterWrapper(), - new MockConfiguration(), new ShardContext()); + new MockConfiguration(), new DatastoreContext()); final TestActorRef subject = TestActorRef.create(system, props); // the run() method needs to finish within 3 seconds - new Within(duration("1 seconds")) { + new Within(duration("10 seconds")) { @Override protected void run() {