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=d16e4f53de7552bd23a1be0ca8d022071bd07245;hb=refs%2Fchanges%2F67%2F10267%2F5;hp=499b4e1f3111d097cc0696aa7cd23367fc4c591d;hpb=63b36aa3537d77bd9be323e1113716ef2cd54098;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 499b4e1f31..d16e4f53de 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 @@ -42,11 +42,12 @@ public class ShardManagerTest { new JavaTestKit(system) {{ final Props props = ShardManager .props("config", new MockClusterWrapper(), - new MockConfiguration(), null); + new MockConfiguration(), new ShardContext()); final TestActorRef subject = TestActorRef.create(system, props); - new Within(duration("1 seconds")) { + new Within(duration("10 seconds")) { + @Override protected void run() { subject.tell(new FindPrimary("inventory").toSerializable(), getRef()); @@ -66,11 +67,12 @@ public class ShardManagerTest { new JavaTestKit(system) {{ final Props props = ShardManager .props("config", new MockClusterWrapper(), - new MockConfiguration(), null); + new MockConfiguration(), new ShardContext()); final TestActorRef subject = TestActorRef.create(system, props); - new Within(duration("1 seconds")) { + new Within(duration("10 seconds")) { + @Override protected void run() { subject.tell(new FindPrimary(Shard.DEFAULT_NAME).toSerializable(), getRef()); @@ -89,16 +91,18 @@ public class ShardManagerTest { new JavaTestKit(system) {{ final Props props = ShardManager .props("config", new MockClusterWrapper(), - new MockConfiguration(), null); + new MockConfiguration(), new ShardContext()); 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) { return ((LocalShardNotFound) in).getShardName(); @@ -124,16 +128,18 @@ public class ShardManagerTest { new JavaTestKit(system) {{ final Props props = ShardManager .props("config", mockClusterWrapper, - new MockConfiguration(), null); + new MockConfiguration(), new ShardContext()); 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(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) { return ((LocalShardFound) in).getPath(); @@ -158,12 +164,13 @@ public class ShardManagerTest { new JavaTestKit(system) {{ final Props props = ShardManager .props("config", new MockClusterWrapper(), - new MockConfiguration(), null); + new MockConfiguration(), new ShardContext()); 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() { MockClusterWrapper.sendMemberUp(subject, "member-2", getRef().path().toString()); @@ -172,6 +179,7 @@ public class ShardManagerTest { final String out = new ExpectMsg(duration("1 seconds"), "primary found") { // do not put code outside this method, will run afterwards + @Override protected String match(Object in) { if (in.getClass().equals(PrimaryFound.SERIALIZABLE_CLASS)) { PrimaryFound f = PrimaryFound.fromSerializable(in); @@ -196,12 +204,13 @@ public class ShardManagerTest { new JavaTestKit(system) {{ final Props props = ShardManager .props("config", new MockClusterWrapper(), - new MockConfiguration(), null); + new MockConfiguration(), new ShardContext()); 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() { MockClusterWrapper.sendMemberUp(subject, "member-2", getRef().path().toString());