From: Tom Pantelis Date: Tue, 26 Jul 2016 05:22:31 +0000 (-0400) Subject: Fix test failure in ShardTest X-Git-Tag: release/boron~42 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=refs%2Fchanges%2F70%2F42570%2F2;hp=f277ff31126e041e88ff63bb27cacec0c1744caf Fix test failure in ShardTest SHardTest#createSnapshotTest failed on jenkins due to using the CallingThreadDispatcher, which is the default for test actors, instead of the default dispatcher. Change-Id: Id0d8186cb8bda356b81a056f4a0fd2bbecd3c7b4 Signed-off-by: Tom Pantelis --- diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java index a7e7e8fb98..87cfae8082 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java @@ -129,7 +129,7 @@ public class ShardTest extends AbstractShardTest { public void testRegisterChangeListener() throws Exception { new ShardTestKit(getSystem()) {{ final TestActorRef shard = actorFactory.createTestActor( - newShardProps(), "testRegisterChangeListener"); + newShardProps().withDispatcher(Dispatchers.DefaultDispatcherId()), "testRegisterChangeListener"); waitUntilLeader(shard); @@ -255,7 +255,7 @@ public class ShardTest extends AbstractShardTest { public void testRegisterDataTreeChangeListener() throws Exception { new ShardTestKit(getSystem()) {{ final TestActorRef shard = actorFactory.createTestActor( - newShardProps(), "testRegisterDataTreeChangeListener"); + newShardProps().withDispatcher(Dispatchers.DefaultDispatcherId()), "testRegisterDataTreeChangeListener"); waitUntilLeader(shard); @@ -437,7 +437,8 @@ public class ShardTest extends AbstractShardTest { @Test public void testApplyState() throws Exception { - final TestActorRef shard = actorFactory.createTestActor(newShardProps(), "testApplyState"); + final TestActorRef shard = actorFactory.createTestActor( + newShardProps().withDispatcher(Dispatchers.DefaultDispatcherId()), "testApplyState"); ShardTestKit.waitUntilLeader(shard); @@ -921,7 +922,8 @@ public class ShardTest extends AbstractShardTest { }; final TestActorRef shard = actorFactory.createTestActor( - Props.create(new DelegatingShardCreator(creator)), "testOnBatchedModificationsWhenNotLeader"); + Props.create(new DelegatingShardCreator(creator)). + withDispatcher(Dispatchers.DefaultDispatcherId()), "testOnBatchedModificationsWhenNotLeader"); waitUntilLeader(shard); @@ -2057,7 +2059,6 @@ public class ShardTest extends AbstractShardTest { testCreateSnapshot(false, "testCreateSnapshotWithNonPersistentData"); } - @SuppressWarnings("serial") private void testCreateSnapshot(final boolean persistent, final String shardActorName) throws Exception{ final AtomicReference latch = new AtomicReference<>(new CountDownLatch(1)); @@ -2104,7 +2105,8 @@ public class ShardTest extends AbstractShardTest { final Creator creator = () -> new TestShard(newShardBuilder()); final TestActorRef shard = actorFactory.createTestActor( - Props.create(new DelegatingShardCreator(creator)), shardActorName); + Props.create(new DelegatingShardCreator(creator)). + withDispatcher(Dispatchers.DefaultDispatcherId()), shardActorName); waitUntilLeader(shard); writeToStore(shard, TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));