Migrate from JavaTestKit to javadsl.TestKit 22/65622/11
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 16 Nov 2017 13:59:36 +0000 (14:59 +0100)
committerTom Pantelis <tompantelis@gmail.com>
Wed, 24 Jan 2018 16:51:13 +0000 (16:51 +0000)
Remove use of deprecated class and use its 2.5.0 replacement. This
leaves a single instance of this class are RaftActorTestKit
and ShartTestKit which will need to be migrated in a follow-up patch.

Change-Id: I5c112f9984bec3ecf2da530f3505aceb83fa1e05
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
67 files changed:
opendaylight/md-sal/cds-access-client/src/test/java/org/opendaylight/controller/cluster/access/client/AbstractClientConnectionTest.java
opendaylight/md-sal/cds-access-client/src/test/java/org/opendaylight/controller/cluster/access/client/AbstractTransmitQueueTest.java
opendaylight/md-sal/cds-access-client/src/test/java/org/opendaylight/controller/cluster/access/client/ActorBehaviorTest.java
opendaylight/md-sal/cds-access-client/src/test/java/org/opendaylight/controller/cluster/access/client/ClientActorContextTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/AbstractActorTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/AbstractRaftActorIntegrationTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/LeadershipTransferIntegrationTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RaftActorServerConfigurationSupportTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RaftActorTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/TestActorFactory.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractLeaderElectionScenarioTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/FollowerTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/LeaderTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/common/actor/MeteredBoundedMailboxTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/common/actor/QuarantinedMonitorActorTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/messaging/AbstractMessagingTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/messaging/MessageSliceReplyTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/messaging/MessageSliceTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/messaging/MessageSlicingIntegrationTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/notifications/RoleChangeNotifierTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/persistence/LocalSnapshotStoreTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractClientHandleTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractDataStoreClientBehaviorTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractProxyTransactionTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/ClientLocalHistoryTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/ClientTransactionCommitCohortTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/DirectTransactionCommitCohortTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/ModuleShardBackendResolverTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/SingleClientHistoryTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractActorTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractClusterRefActorTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractTransactionProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataTreeChangeListenerActorTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataTreeChangeListenerProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataTreeChangeListenerSupportTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataTreeCohortIntegrationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreRemotingIntegrationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/RoleChangeNotifierTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTestKit.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/actors/DataTreeNotificationListenerRegistrationActorTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/actors/ShardSnapshotActorTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/AbstractClusterRefEntityOwnershipTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/CandidateListChangeListenerTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/DistributedEntityOwnershipIntegrationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnershipListenerSupportTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnershipShardTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManagerGetSnapshotReplyActorTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManagerTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorContextTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/sharding/DistributedShardedDOMDataTreeRemotingTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/sharding/DistributedShardedDOMDataTreeTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/sharding/RoleChangeListenerActorTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/AbstractRpcTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RemoteRpcProviderTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RpcBrokerTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RpcListenerTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RpcRegistrarTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/RpcRegistryTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/gossip/BucketStoreTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/gossip/GossiperTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/mbeans/RemoteRpcRegistryMXBeanImplTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/utils/LatestEntryRoutingLogicTest.java

index 9cd2d1c..7784a21 100644 (file)
@@ -16,8 +16,8 @@ import static org.opendaylight.controller.cluster.access.client.ConnectionEntryM
 
 import akka.actor.ActorRef;
 import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.collect.Iterables;
 import java.util.Optional;
 import java.util.function.Consumer;
@@ -143,7 +143,7 @@ public abstract class AbstractClientConnectionTest<T extends AbstractClientConne
 
     @After
     public void tearDown() throws Exception {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
     }
 
     protected Request<?, ?> createRequest(final ActorRef replyTo) {
index 3800da8..464acdc 100644 (file)
@@ -14,8 +14,8 @@ import static org.mockito.Mockito.verify;
 import static org.opendaylight.controller.cluster.access.client.ConnectionEntryMatcher.entryWithRequest;
 
 import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.base.Ticker;
 import java.util.Collection;
 import java.util.Optional;
@@ -63,7 +63,7 @@ public abstract class AbstractTransmitQueueTest<T extends TransmitQueue> {
 
     @After
     public void tearDown() throws Exception {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
     }
 
     @Test
index 598b598..8254465 100644 (file)
@@ -19,8 +19,8 @@ import akka.actor.Props;
 import akka.persistence.Persistence;
 import akka.persistence.SelectedSnapshot;
 import akka.persistence.SnapshotMetadata;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
 import java.lang.reflect.Field;
 import java.util.Optional;
 import java.util.concurrent.TimeUnit;
@@ -63,7 +63,7 @@ public class ActorBehaviorTest {
 
     @After
     public void tearDown() throws Exception {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
     }
 
     @Test
index 564a2ed..4dcbccb 100644 (file)
@@ -10,8 +10,8 @@ package org.opendaylight.controller.cluster.access.client;
 import static org.junit.Assert.assertSame;
 
 import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.base.Ticker;
 import java.util.concurrent.TimeUnit;
 import org.junit.After;
@@ -76,6 +76,6 @@ public class ClientActorContextTest {
 
     @After
     public void tearDown() throws Exception {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
     }
 }
index d16e5ef..7c1e778 100644 (file)
@@ -9,7 +9,7 @@
 package org.opendaylight.controller.cluster.raft;
 
 import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import java.io.File;
 import java.io.IOException;
 import org.apache.commons.io.FileUtils;
@@ -38,7 +38,7 @@ public abstract class AbstractActorTest {
     @AfterClass
     public static void tearDownClass() throws Exception {
         deleteJournal();
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
         system = null;
     }
 
index ef4151d..ac970c6 100644 (file)
@@ -17,8 +17,8 @@ import akka.actor.PoisonPill;
 import akka.actor.Terminated;
 import akka.dispatch.Dispatchers;
 import akka.dispatch.Mailboxes;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
 import akka.util.Timeout;
 import com.google.common.base.Stopwatch;
 import com.google.common.collect.ImmutableMap;
@@ -275,11 +275,11 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest
     }
 
     protected void killActor(final TestActorRef<TestRaftActor> actor) {
-        JavaTestKit testkit = new JavaTestKit(getSystem());
+        TestKit testkit = new TestKit(getSystem());
         testkit.watch(actor);
 
         actor.tell(PoisonPill.getInstance(), null);
-        testkit.expectMsgClass(JavaTestKit.duration("5 seconds"), Terminated.class);
+        testkit.expectMsgClass(testkit.duration("5 seconds"), Terminated.class);
 
         testkit.unwatch(actor);
     }
index 48c9fee..2ed6907 100644 (file)
@@ -16,8 +16,8 @@ import static org.opendaylight.controller.cluster.raft.utils.MessageCollectorAct
 import akka.actor.ActorRef;
 import akka.actor.Status;
 import akka.pattern.Patterns;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.collect.ImmutableMap;
 import java.util.Arrays;
 import java.util.Collections;
@@ -325,8 +325,8 @@ public class LeadershipTransferIntegrationTest extends AbstractRaftActorIntegrat
         createRaftActors();
         createRequestLeadershipResultCollectorActor();
 
-        factory.killActor(follower1Actor, new JavaTestKit(getSystem()));
-        factory.killActor(follower3Actor, new JavaTestKit(getSystem()));
+        factory.killActor(follower1Actor, new TestKit(getSystem()));
+        factory.killActor(follower3Actor, new TestKit(getSystem()));
 
         sendFollower2RequestLeadershipTransferToLeader();
 
index e844ddf..29aadbb 100644 (file)
@@ -19,8 +19,8 @@ import akka.actor.ActorRef;
 import akka.actor.Props;
 import akka.actor.UntypedActor;
 import akka.dispatch.Dispatchers;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.base.Optional;
 import com.google.common.base.Stopwatch;
 import com.google.common.collect.ImmutableMap;
@@ -101,7 +101,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
     private ActorRef newFollowerCollectorActor;
     private RaftActorContext newFollowerActorContext;
 
-    private final JavaTestKit testKit = new JavaTestKit(getSystem());
+    private final TestKit testKit = new TestKit(getSystem());
 
     @Before
     public void setup() {
@@ -173,7 +173,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
         List<Object> snapshotState = MockRaftActor.fromState(applySnapshot.getSnapshot().getState());
         assertEquals("Snapshot state", snapshotState, leaderRaftActor.getState());
 
-        AddServerReply addServerReply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"), AddServerReply.class);
+        AddServerReply addServerReply = testKit.expectMsgClass(testKit.duration("5 seconds"), AddServerReply.class);
         assertEquals("getStatus", ServerChangeStatus.OK, addServerReply.getStatus());
         assertEquals("getLeaderHint", LEADER_ID, addServerReply.getLeaderHint().get());
 
@@ -253,7 +253,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
         List<Object> snapshotState = MockRaftActor.fromState(applySnapshot.getSnapshot().getState());
         assertEquals("Snapshot state", snapshotState, leaderRaftActor.getState());
 
-        AddServerReply addServerReply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"), AddServerReply.class);
+        AddServerReply addServerReply = testKit.expectMsgClass(testKit.duration("5 seconds"), AddServerReply.class);
         assertEquals("getStatus", ServerChangeStatus.OK, addServerReply.getStatus());
         assertEquals("getLeaderHint", LEADER_ID, addServerReply.getLeaderHint().get());
 
@@ -299,7 +299,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
 
         leaderActor.tell(new AddServer(NEW_SERVER_ID, newFollowerRaftActor.path().toString(), false), testKit.getRef());
 
-        AddServerReply addServerReply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"), AddServerReply.class);
+        AddServerReply addServerReply = testKit.expectMsgClass(testKit.duration("5 seconds"), AddServerReply.class);
         assertEquals("getStatus", ServerChangeStatus.OK, addServerReply.getStatus());
         assertEquals("getLeaderHint", LEADER_ID, addServerReply.getLeaderHint().get());
 
@@ -336,7 +336,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
 
         leaderActor.tell(new AddServer(NEW_SERVER_ID2, followerActor.path().toString(), false), testKit.getRef());
 
-        addServerReply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"), AddServerReply.class);
+        addServerReply = testKit.expectMsgClass(testKit.duration("5 seconds"), AddServerReply.class);
         assertEquals("getStatus", ServerChangeStatus.OK, addServerReply.getStatus());
         assertEquals("getLeaderHint", java.util.Optional.of(LEADER_ID), addServerReply.getLeaderHint());
 
@@ -381,7 +381,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
         InstallSnapshot installSnapshot = expectFirstMatching(newFollowerCollectorActor, InstallSnapshot.class);
 
         // Send a second AddServer - should get queued
-        JavaTestKit testKit2 = new JavaTestKit(getSystem());
+        TestKit testKit2 = new TestKit(getSystem());
         leaderActor.tell(new AddServer(NEW_SERVER_ID2, followerActor.path().toString(), false), testKit2.getRef());
 
         // Continue the first AddServer
@@ -389,10 +389,10 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
         newFollowerRaftActor.tell(installSnapshot, leaderActor);
 
         // Verify both complete successfully
-        AddServerReply addServerReply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"), AddServerReply.class);
+        AddServerReply addServerReply = testKit.expectMsgClass(testKit.duration("5 seconds"), AddServerReply.class);
         assertEquals("getStatus", ServerChangeStatus.OK, addServerReply.getStatus());
 
-        addServerReply = testKit2.expectMsgClass(JavaTestKit.duration("5 seconds"), AddServerReply.class);
+        addServerReply = testKit2.expectMsgClass(testKit2.duration("5 seconds"), AddServerReply.class);
         assertEquals("getStatus", ServerChangeStatus.OK, addServerReply.getStatus());
 
         // Verify ServerConfigurationPayload entries in leader's log
@@ -442,7 +442,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
         leaderRaftActor.setDropMessageOfType(null);
         leaderActor.tell(commitMsg, leaderActor);
 
-        AddServerReply addServerReply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"), AddServerReply.class);
+        AddServerReply addServerReply = testKit.expectMsgClass(testKit.duration("5 seconds"), AddServerReply.class);
         assertEquals("getStatus", ServerChangeStatus.OK, addServerReply.getStatus());
         assertEquals("getLeaderHint", LEADER_ID, addServerReply.getLeaderHint().get());
 
@@ -484,7 +484,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
 
         leaderActor.tell(new AddServer(NEW_SERVER_ID, newFollowerRaftActor.path().toString(), true), testKit.getRef());
 
-        AddServerReply addServerReply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"), AddServerReply.class);
+        AddServerReply addServerReply = testKit.expectMsgClass(testKit.duration("5 seconds"), AddServerReply.class);
         assertEquals("getStatus", ServerChangeStatus.TIMEOUT, addServerReply.getStatus());
 
         assertEquals("Leader peers size", 0, leaderActorContext.getPeerIds().size());
@@ -532,7 +532,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
 
         leaderActor.tell(new RaftActorServerConfigurationSupport.ServerOperationTimeout(NEW_SERVER_ID), leaderActor);
 
-        AddServerReply addServerReply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"), AddServerReply.class);
+        AddServerReply addServerReply = testKit.expectMsgClass(testKit.duration("5 seconds"), AddServerReply.class);
         assertEquals("getStatus", ServerChangeStatus.NO_LEADER, addServerReply.getStatus());
 
         assertEquals("Leader peers size", 0, leaderActorContext.getPeerIds().size());
@@ -578,7 +578,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
         leaderRaftActor.setDropMessageOfType(null);
         leaderActor.tell(snapshotReply, leaderActor);
 
-        AddServerReply addServerReply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"), AddServerReply.class);
+        AddServerReply addServerReply = testKit.expectMsgClass(testKit.duration("5 seconds"), AddServerReply.class);
         assertEquals("getStatus", ServerChangeStatus.NO_LEADER, addServerReply.getStatus());
 
         assertEquals("Leader peers size", 0, leaderActorContext.getPeerIds().size());
@@ -609,7 +609,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
 
         leaderActor.tell(new UnInitializedFollowerSnapshotReply("bogus"), leaderActor);
 
-        AddServerReply addServerReply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"), AddServerReply.class);
+        AddServerReply addServerReply = testKit.expectMsgClass(testKit.duration("5 seconds"), AddServerReply.class);
         assertEquals("getStatus", ServerChangeStatus.TIMEOUT, addServerReply.getStatus());
 
         assertEquals("Leader peers size", 0, leaderActorContext.getPeerIds().size());
@@ -636,7 +636,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
 
         noLeaderActor.tell(new AddServer(NEW_SERVER_ID, newFollowerRaftActor.path().toString(), true),
                 testKit.getRef());
-        AddServerReply addServerReply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"), AddServerReply.class);
+        AddServerReply addServerReply = testKit.expectMsgClass(testKit.duration("5 seconds"), AddServerReply.class);
         assertEquals("getStatus", ServerChangeStatus.NO_LEADER, addServerReply.getStatus());
 
         LOG.info("testAddServerWithNoLeader ending");
@@ -683,7 +683,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
         leaderActor.tell(new AddServer(NEW_SERVER_ID2, "", false), testKit.getRef());
 
         // The first AddServer should succeed with OK even though consensus wasn't reached
-        AddServerReply addServerReply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"), AddServerReply.class);
+        AddServerReply addServerReply = testKit.expectMsgClass(testKit.duration("5 seconds"), AddServerReply.class);
         assertEquals("getStatus", ServerChangeStatus.OK, addServerReply.getStatus());
         assertEquals("getLeaderHint", LEADER_ID, addServerReply.getLeaderHint().get());
 
@@ -692,12 +692,12 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
                 votingServer(NEW_SERVER_ID));
 
         // The second AddServer should fail since consensus wasn't reached for the first
-        addServerReply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"), AddServerReply.class);
+        addServerReply = testKit.expectMsgClass(testKit.duration("5 seconds"), AddServerReply.class);
         assertEquals("getStatus", ServerChangeStatus.PRIOR_REQUEST_CONSENSUS_TIMEOUT, addServerReply.getStatus());
 
         // Re-send the second AddServer - should also fail
         leaderActor.tell(new AddServer(NEW_SERVER_ID2, "", false), testKit.getRef());
-        addServerReply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"), AddServerReply.class);
+        addServerReply = testKit.expectMsgClass(testKit.duration("5 seconds"), AddServerReply.class);
         assertEquals("getStatus", ServerChangeStatus.PRIOR_REQUEST_CONSENSUS_TIMEOUT, addServerReply.getStatus());
 
         LOG.info("testAddServerWithNoConsensusReached ending");
@@ -716,7 +716,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
 
         leaderActor.tell(new AddServer(FOLLOWER_ID, followerActor.path().toString(), true), testKit.getRef());
 
-        AddServerReply addServerReply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"), AddServerReply.class);
+        AddServerReply addServerReply = testKit.expectMsgClass(testKit.duration("5 seconds"), AddServerReply.class);
         assertEquals("getStatus", ServerChangeStatus.ALREADY_EXISTS, addServerReply.getStatus());
 
         LOG.info("testAddServerWithExistingServer ending");
@@ -793,7 +793,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
         leaderActor.underlyingActor().waitForInitializeBehaviorComplete();
 
         leaderActor.tell(new RemoveServer(FOLLOWER_ID), testKit.getRef());
-        RemoveServerReply removeServerReply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"),
+        RemoveServerReply removeServerReply = testKit.expectMsgClass(testKit.duration("5 seconds"),
                 RemoveServerReply.class);
         assertEquals("getStatus", ServerChangeStatus.NO_LEADER, removeServerReply.getStatus());
 
@@ -812,7 +812,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
                 actorFactory.generateActorId(LEADER_ID));
 
         leaderActor.tell(new RemoveServer(NEW_SERVER_ID), testKit.getRef());
-        RemoveServerReply removeServerReply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"),
+        RemoveServerReply removeServerReply = testKit.expectMsgClass(testKit.duration("5 seconds"),
                 RemoveServerReply.class);
         assertEquals("getStatus", ServerChangeStatus.DOES_NOT_EXIST, removeServerReply.getStatus());
 
@@ -886,7 +886,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
         follower2Actor.underlyingActor().waitForInitializeBehaviorComplete();
 
         leaderActor.tell(new RemoveServer(FOLLOWER_ID), testKit.getRef());
-        RemoveServerReply removeServerReply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"),
+        RemoveServerReply removeServerReply = testKit.expectMsgClass(testKit.duration("5 seconds"),
                 RemoveServerReply.class);
         assertEquals("getStatus", ServerChangeStatus.OK, removeServerReply.getStatus());
 
@@ -937,7 +937,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
                 followerActorId);
 
         leaderActor.tell(new RemoveServer(LEADER_ID), testKit.getRef());
-        RemoveServerReply removeServerReply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"),
+        RemoveServerReply removeServerReply = testKit.expectMsgClass(testKit.duration("5 seconds"),
                 RemoveServerReply.class);
         assertEquals("getStatus", ServerChangeStatus.OK, removeServerReply.getStatus());
 
@@ -961,7 +961,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
                 actorFactory.generateActorId(LEADER_ID));
 
         leaderActor.tell(new RemoveServer(LEADER_ID), testKit.getRef());
-        RemoveServerReply removeServerReply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"),
+        RemoveServerReply removeServerReply = testKit.expectMsgClass(testKit.duration("5 seconds"),
                 RemoveServerReply.class);
         assertEquals("getStatus", ServerChangeStatus.NOT_SUPPORTED, removeServerReply.getStatus());
 
@@ -1005,7 +1005,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
 
         leaderActor.tell(new ChangeServersVotingStatus(ImmutableMap.of(FOLLOWER_ID, false, FOLLOWER_ID2, false)),
                 testKit.getRef());
-        ServerChangeReply reply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"), ServerChangeReply.class);
+        ServerChangeReply reply = testKit.expectMsgClass(testKit.duration("5 seconds"), ServerChangeReply.class);
         assertEquals("getStatus", ServerChangeStatus.OK, reply.getStatus());
 
         final ApplyState applyState = MessageCollectorActor.expectFirstMatching(leaderCollector, ApplyState.class);
@@ -1030,7 +1030,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
         // Send second ChangeServersVotingStatus message
 
         leaderActor.tell(new ChangeServersVotingStatus(ImmutableMap.of(FOLLOWER_ID, true)), testKit.getRef());
-        reply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"), ServerChangeReply.class);
+        reply = testKit.expectMsgClass(testKit.duration("5 seconds"), ServerChangeReply.class);
         assertEquals("getStatus", ServerChangeStatus.OK, reply.getStatus());
 
         MessageCollectorActor.expectFirstMatching(leaderCollector, ApplyState.class);
@@ -1083,7 +1083,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
         // Send ChangeServersVotingStatus message
 
         leaderActor.tell(new ChangeServersVotingStatus(ImmutableMap.of(LEADER_ID, false)), testKit.getRef());
-        ServerChangeReply reply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"), ServerChangeReply.class);
+        ServerChangeReply reply = testKit.expectMsgClass(testKit.duration("5 seconds"), ServerChangeReply.class);
         assertEquals("getStatus", ServerChangeStatus.OK, reply.getStatus());
 
         MessageCollectorActor.expectFirstMatching(leaderCollector, ApplyState.class);
@@ -1115,7 +1115,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
                         .withDispatcher(Dispatchers.DefaultDispatcherId()), actorFactory.generateActorId(LEADER_ID));
 
         leaderActor.tell(new ChangeServersVotingStatus(ImmutableMap.of(LEADER_ID, false)), testKit.getRef());
-        ServerChangeReply reply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"), ServerChangeReply.class);
+        ServerChangeReply reply = testKit.expectMsgClass(testKit.duration("5 seconds"), ServerChangeReply.class);
         assertEquals("getStatus", ServerChangeStatus.INVALID_REQUEST, reply.getStatus());
 
         LOG.info("testChangeLeaderToNonVotingInSingleNode ending");
@@ -1188,7 +1188,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
         ChangeServersVotingStatus changeServers = new ChangeServersVotingStatus(ImmutableMap.of(node1ID, true,
                 node2ID, true, "downNode1", false, "downNode2", false));
         node1RaftActorRef.tell(changeServers, testKit.getRef());
-        ServerChangeReply reply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"), ServerChangeReply.class);
+        ServerChangeReply reply = testKit.expectMsgClass(testKit.duration("5 seconds"), ServerChangeReply.class);
         assertEquals("getStatus", ServerChangeStatus.NO_LEADER, reply.getStatus());
         assertEquals("getRaftState", RaftState.Follower, node1RaftActor.getRaftState());
 
@@ -1209,7 +1209,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
         node1RaftActor.setPeerAddress(node2ID, node2RaftActorRef.path().toString());
 
         node1RaftActorRef.tell(changeServers, testKit.getRef());
-        reply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"), ServerChangeReply.class);
+        reply = testKit.expectMsgClass(testKit.duration("5 seconds"), ServerChangeReply.class);
         assertEquals("getStatus", ServerChangeStatus.OK, reply.getStatus());
 
         ApplyJournalEntries apply = MessageCollectorActor.expectFirstMatching(node1Collector,
@@ -1283,7 +1283,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
 
         ChangeServersVotingStatus changeServers = new ChangeServersVotingStatus(ImmutableMap.of(node1ID, true));
         node1RaftActorRef.tell(changeServers, testKit.getRef());
-        ServerChangeReply reply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"), ServerChangeReply.class);
+        ServerChangeReply reply = testKit.expectMsgClass(testKit.duration("5 seconds"), ServerChangeReply.class);
         assertEquals("getStatus", ServerChangeStatus.NO_LEADER, reply.getStatus());
 
         assertEquals("Server config", Sets.newHashSet(nonVotingServer(node1ID), votingServer(node2ID)),
@@ -1343,7 +1343,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
         ChangeServersVotingStatus changeServers = new ChangeServersVotingStatus(
                 ImmutableMap.of(node1ID, true, node2ID, true));
         node1RaftActorRef.tell(changeServers, testKit.getRef());
-        ServerChangeReply reply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"), ServerChangeReply.class);
+        ServerChangeReply reply = testKit.expectMsgClass(testKit.duration("5 seconds"), ServerChangeReply.class);
         assertEquals("getStatus", ServerChangeStatus.OK, reply.getStatus());
 
         MessageCollectorActor.expectFirstMatching(node2Collector, ApplyJournalEntries.class);
@@ -1413,7 +1413,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
 
         node2RaftActorRef.tell(TimeoutNow.INSTANCE, ActorRef.noSender());
 
-        ServerChangeReply reply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"), ServerChangeReply.class);
+        ServerChangeReply reply = testKit.expectMsgClass(testKit.duration("5 seconds"), ServerChangeReply.class);
         assertEquals("getStatus", ServerChangeStatus.OK, reply.getStatus());
 
         MessageCollectorActor.expectFirstMatching(node1Collector, ApplyJournalEntries.class);
index b8be07a..56089ec 100644 (file)
@@ -35,8 +35,8 @@ import akka.persistence.SaveSnapshotFailure;
 import akka.persistence.SaveSnapshotSuccess;
 import akka.persistence.SnapshotMetadata;
 import akka.persistence.SnapshotOffer;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.util.concurrent.Uninterruptibles;
@@ -128,7 +128,7 @@ public class RaftActorTest extends AbstractActorTest {
     public void testRaftActorRecoveryWithPersistenceEnabled() throws Exception {
         TEST_LOG.info("testRaftActorRecoveryWithPersistenceEnabled starting");
 
-        JavaTestKit kit = new JavaTestKit(getSystem());
+        TestKit kit = new TestKit(getSystem());
         String persistenceId = factory.generateActorId("follower-");
 
         DefaultConfigParamsImpl config = new DefaultConfigParamsImpl();
@@ -183,7 +183,7 @@ public class RaftActorTest extends AbstractActorTest {
 
         // kill the actor
         followerActor.tell(PoisonPill.getInstance(), null);
-        kit.expectMsgClass(JavaTestKit.duration("5 seconds"), Terminated.class);
+        kit.expectMsgClass(kit.duration("5 seconds"), Terminated.class);
 
         kit.unwatch(followerActor);
 
@@ -234,7 +234,7 @@ public class RaftActorTest extends AbstractActorTest {
 
     @Test
     public void testUpdateElectionTermPersistedWithPersistenceDisabled() throws Exception {
-        final JavaTestKit kit = new JavaTestKit(getSystem());
+        final TestKit kit = new TestKit(getSystem());
         String persistenceId = factory.generateActorId("follower-");
         DefaultConfigParamsImpl config = new DefaultConfigParamsImpl();
         config.setHeartBeatInterval(new FiniteDuration(100, TimeUnit.MILLISECONDS));
@@ -1009,7 +1009,7 @@ public class RaftActorTest extends AbstractActorTest {
     public void testGetSnapshot() throws Exception {
         TEST_LOG.info("testGetSnapshot starting");
 
-        final JavaTestKit kit = new JavaTestKit(getSystem());
+        final TestKit kit = new TestKit(getSystem());
 
         String persistenceId = factory.generateActorId("test-actor-");
         DefaultConfigParamsImpl config = new DefaultConfigParamsImpl();
index 639436d..ea38c16 100644 (file)
@@ -8,14 +8,6 @@
 
 package org.opendaylight.controller.cluster.raft;
 
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
 import akka.actor.Actor;
 import akka.actor.ActorIdentity;
 import akka.actor.ActorRef;
@@ -26,8 +18,8 @@ import akka.actor.InvalidActorNameException;
 import akka.actor.PoisonPill;
 import akka.actor.Props;
 import akka.pattern.Patterns;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
 import akka.util.Timeout;
 import com.google.common.base.Stopwatch;
 import com.google.common.util.concurrent.Uninterruptibles;
@@ -181,15 +173,15 @@ public class TestActorFactory implements AutoCloseable {
         return prefix + actorCount++;
     }
 
-    public void killActor(ActorRef actor, JavaTestKit kit) {
+    public void killActor(ActorRef actor, TestKit kit) {
         killActor(actor, kit, true);
     }
 
-    private void killActor(ActorRef actor, JavaTestKit kit, boolean remove) {
+    private void killActor(ActorRef actor, TestKit kit, boolean remove) {
         LOG.info("Killing actor {}", actor);
         kit.watch(actor);
         actor.tell(PoisonPill.getInstance(), ActorRef.noSender());
-        kit.expectTerminated(JavaTestKit.duration("5 seconds"), actor);
+        kit.expectTerminated(kit.duration("5 seconds"), actor);
 
         if (remove) {
             createdActors.remove(actor);
@@ -202,7 +194,7 @@ public class TestActorFactory implements AutoCloseable {
 
     @Override
     public void close() {
-        JavaTestKit kit = new JavaTestKit(system);
+        TestKit kit = new TestKit(system);
         for (ActorRef actor : createdActors) {
             killActor(actor, kit, false);
         }
index 1212274..f3d1aac 100644 (file)
@@ -19,8 +19,8 @@ import akka.dispatch.ControlMessage;
 import akka.dispatch.Dispatchers;
 import akka.dispatch.Mailboxes;
 import akka.pattern.Patterns;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
 import akka.util.Timeout;
 import com.google.common.util.concurrent.Uninterruptibles;
 import java.util.Map;
@@ -227,7 +227,7 @@ public class AbstractLeaderElectionScenarioTest {
 
     @After
     public void tearDown() throws Exception {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
     }
 
     DefaultConfigParamsImpl newConfigParams() {
index ab82188..c4d97ea 100644 (file)
@@ -21,8 +21,8 @@ import static org.mockito.Mockito.verify;
 
 import akka.actor.ActorRef;
 import akka.dispatch.Dispatchers;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.base.Optional;
 import com.google.common.base.Stopwatch;
 import com.google.common.collect.ImmutableList;
@@ -1212,7 +1212,7 @@ public class FollowerTest extends AbstractRaftActorBehaviorTest<Follower> {
 
         // Reinstate the actor from persistence
 
-        actorFactory.killActor(followerActorRef, new JavaTestKit(getSystem()));
+        actorFactory.killActor(followerActorRef, new TestKit(getSystem()));
 
         followerActorRef = actorFactory.createTestActor(builder.props()
                 .withDispatcher(Dispatchers.DefaultDispatcherId()), id);
index 5317ec4..04ae7ff 100644 (file)
@@ -23,8 +23,8 @@ import akka.actor.ActorRef;
 import akka.actor.PoisonPill;
 import akka.actor.Props;
 import akka.actor.Terminated;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.io.ByteSource;
@@ -1916,7 +1916,7 @@ public class LeaderTest extends AbstractLeaderTest<Leader> {
         assertTrue("Behavior not instance of Leader when all followers are active", newBehavior instanceof Leader);
 
         // kill 1 follower and verify if that got killed
-        final JavaTestKit probe = new JavaTestKit(getSystem());
+        final TestKit probe = new TestKit(getSystem());
         probe.watch(followerActor1);
         followerActor1.tell(PoisonPill.getInstance(), ActorRef.noSender());
         final Terminated termMsg1 = probe.expectMsgClass(Terminated.class);
index 7f91c1b..a402974 100644 (file)
@@ -12,7 +12,7 @@ import akka.actor.ActorSystem;
 import akka.actor.DeadLetter;
 import akka.actor.Props;
 import akka.actor.UntypedActor;
-import akka.testkit.JavaTestKit;
+import akka.testkit.TestKit;
 import com.typesafe.config.ConfigFactory;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.ReentrantLock;
@@ -43,8 +43,8 @@ public class MeteredBoundedMailboxTest {
 
     @Test
     public void shouldSendMsgToDeadLetterWhenQueueIsFull() throws InterruptedException {
-        final JavaTestKit mockReceiver = new JavaTestKit(actorSystem);
-        actorSystem.eventStream().subscribe(mockReceiver.getRef(), DeadLetter.class);
+        final TestKit mockReceiver = new TestKit(actorSystem);
+        actorSystem.eventStream().subscribe(mockReceiver.testActor(), DeadLetter.class);
 
         final FiniteDuration twentySeconds = new FiniteDuration(20, TimeUnit.SECONDS);
 
@@ -59,7 +59,7 @@ public class MeteredBoundedMailboxTest {
             //2nd to 11th messages are put on the queue
             //12th message is sent to dead letter.
             for (int i = 0; i < 12; i++) {
-                pingPongActor.tell("ping", mockReceiver.getRef());
+                pingPongActor.tell("ping", mockReceiver.testActor());
             }
 
             mockReceiver.expectMsgClass(twentySeconds, DeadLetter.class);
index f3a453b..1a72f20 100644 (file)
@@ -19,7 +19,7 @@ import akka.japi.Effect;
 import akka.remote.AssociationErrorEvent;
 import akka.remote.InvalidAssociation;
 import akka.remote.ThisActorSystemQuarantinedEvent;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -46,7 +46,7 @@ public class QuarantinedMonitorActorTest {
 
     @After
     public void tearDown() throws Exception {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
     }
 
     @Test
index c473899..7e53922 100644 (file)
@@ -13,8 +13,8 @@ import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.doReturn;
 
 import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.io.ByteSource;
 import java.io.IOException;
 import java.io.InputStream;
@@ -71,7 +71,7 @@ public class AbstractMessagingTest {
 
     @AfterClass
     public static void tearDownClass() {
-        JavaTestKit.shutdownActorSystem(ACTOR_SYSTEM, Boolean.TRUE);
+        TestKit.shutdownActorSystem(ACTOR_SYSTEM, true);
     }
 
     void setupMockFiledBackedStream(final FileBackedOutputStream mockOutputStream) throws IOException {
index fa31fbf..51c4479 100644 (file)
@@ -8,12 +8,14 @@
 package org.opendaylight.controller.cluster.messaging;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 import akka.actor.ActorSystem;
 import akka.actor.ExtendedActorSystem;
 import akka.serialization.JavaSerializer;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
 import org.apache.commons.lang.SerializationUtils;
 import org.junit.After;
 import org.junit.Before;
@@ -34,7 +36,7 @@ public class MessageSliceReplyTest {
 
     @After
     public void tearDown() {
-        JavaTestKit.shutdownActorSystem(actorSystem, Boolean.TRUE);
+        TestKit.shutdownActorSystem(actorSystem, true);
     }
 
     @Test
@@ -51,7 +53,7 @@ public class MessageSliceReplyTest {
         assertEquals("getIdentifier", expected.getIdentifier(), cloned.getIdentifier());
         assertEquals("getSliceIndex", expected.getSliceIndex(), cloned.getSliceIndex());
         assertEquals("getSendTo", expected.getSendTo(), cloned.getSendTo());
-        assertEquals("getFailure present", Boolean.FALSE, cloned.getFailure().isPresent());
+        assertFalse("getFailure present", cloned.getFailure().isPresent());
     }
 
     private void testFailure() {
@@ -62,7 +64,7 @@ public class MessageSliceReplyTest {
         assertEquals("getIdentifier", expected.getIdentifier(), cloned.getIdentifier());
         assertEquals("getSliceIndex", expected.getSliceIndex(), cloned.getSliceIndex());
         assertEquals("getSendTo", expected.getSendTo(), cloned.getSendTo());
-        assertEquals("getFailure present", Boolean.TRUE, cloned.getFailure().isPresent());
+        assertTrue("getFailure present", cloned.getFailure().isPresent());
         assertEquals("getFailure message", expected.getFailure().get().getMessage(),
                 cloned.getFailure().get().getMessage());
         assertEquals("getFailure isRetriable", expected.getFailure().get().isRetriable(),
index 6331e0b..dc2e6de 100644 (file)
@@ -13,8 +13,8 @@ import static org.junit.Assert.assertEquals;
 import akka.actor.ActorSystem;
 import akka.actor.ExtendedActorSystem;
 import akka.serialization.JavaSerializer;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
 import org.apache.commons.lang.SerializationUtils;
 import org.junit.After;
 import org.junit.Before;
@@ -35,7 +35,7 @@ public class MessageSliceTest {
 
     @After
     public void tearDown() {
-        JavaTestKit.shutdownActorSystem(actorSystem, Boolean.TRUE);
+        TestKit.shutdownActorSystem(actorSystem, Boolean.TRUE);
     }
 
     @Test
index 7318960..d78e639 100644 (file)
@@ -19,8 +19,8 @@ import static org.opendaylight.controller.cluster.messaging.MessageSlicerTest.sl
 
 import akka.actor.ActorRef;
 import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.ObjectOutputStream;
@@ -79,7 +79,7 @@ public class MessageSlicingIntegrationTest {
 
     @AfterClass
     public static void staticTearDown() {
-        JavaTestKit.shutdownActorSystem(ACTOR_SYSTEM, Boolean.TRUE);
+        TestKit.shutdownActorSystem(ACTOR_SYSTEM, true);
     }
 
     @Test
index ab65929..c361963 100644 (file)
@@ -9,8 +9,8 @@ package org.opendaylight.controller.cluster.notifications;
 
 import akka.actor.ActorRef;
 import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
 import java.util.ArrayList;
 import java.util.List;
 import org.junit.After;
@@ -38,7 +38,7 @@ public class RoleChangeNotifierTest {
 
     @After
     public void tearDown() throws Exception {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
     }
 
     @Test
index 417a9db..e23a37a 100644 (file)
@@ -27,7 +27,7 @@ import akka.persistence.SnapshotProtocol.LoadSnapshotResult;
 import akka.persistence.SnapshotSelectionCriteria;
 import akka.persistence.serialization.Snapshot;
 import akka.persistence.serialization.SnapshotSerializer;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import com.typesafe.config.ConfigFactory;
 import java.io.File;
 import java.io.FileOutputStream;
@@ -69,7 +69,7 @@ public class LocalSnapshotStoreTest {
     @AfterClass
     public static void staticCleanup() {
         FileUtils.deleteQuietly(SNAPSHOT_DIR);
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
     }
 
     @Before
@@ -100,7 +100,7 @@ public class LocalSnapshotStoreTest {
 
         SnapshotMetadata metadata3 = new SnapshotMetadata(PERSISTENCE_ID, 1, 3000);
 
-        JavaTestKit probe = new JavaTestKit(system);
+        TestKit probe = new TestKit(system);
         snapshotStore.tell(new LoadSnapshot(PERSISTENCE_ID,
                 SnapshotSelectionCriteria.latest(), Long.MAX_VALUE), probe.getRef());
         LoadSnapshotResult result = probe.expectMsgClass(LoadSnapshotResult.class);
@@ -124,7 +124,7 @@ public class LocalSnapshotStoreTest {
 
     @Test
     public void testDoLoadAsyncWithNoSnapshots() throws IOException {
-        JavaTestKit probe = new JavaTestKit(system);
+        TestKit probe = new TestKit(system);
         snapshotStore.tell(new LoadSnapshot(PERSISTENCE_ID,
                 SnapshotSelectionCriteria.latest(), Long.MAX_VALUE), probe.getRef());
         LoadSnapshotResult result = probe.expectMsgClass(LoadSnapshotResult.class);
@@ -140,7 +140,7 @@ public class LocalSnapshotStoreTest {
 
         SnapshotMetadata metadata = new SnapshotMetadata(PERSISTENCE_ID, 0, 1000);
 
-        JavaTestKit probe = new JavaTestKit(system);
+        TestKit probe = new TestKit(system);
         snapshotStore.tell(new LoadSnapshot(PERSISTENCE_ID,
                 SnapshotSelectionCriteria.latest(), Long.MAX_VALUE), probe.getRef());
         LoadSnapshotResult result = probe.expectMsgClass(LoadSnapshotResult.class);
@@ -156,7 +156,7 @@ public class LocalSnapshotStoreTest {
     public void testDoLoadAsyncWithFailure() throws Throwable {
         createSnapshotFile(PERSISTENCE_ID, null, 1, 2000);
 
-        JavaTestKit probe = new JavaTestKit(system);
+        TestKit probe = new TestKit(system);
         snapshotStore.tell(new SnapshotProtocol.LoadSnapshot(PERSISTENCE_ID,
                 SnapshotSelectionCriteria.latest(), Long.MAX_VALUE), probe.getRef());
         LoadSnapshotFailed failed = probe.expectMsgClass(LoadSnapshotFailed.class);
@@ -174,7 +174,7 @@ public class LocalSnapshotStoreTest {
 
         SnapshotMetadata metadata = new SnapshotMetadata(PERSISTENCE_ID, 1, 1000);
 
-        JavaTestKit probe = new JavaTestKit(system);
+        TestKit probe = new TestKit(system);
         snapshotStore.tell(new LoadSnapshot(PERSISTENCE_ID,
                 SnapshotSelectionCriteria.latest(), Long.MAX_VALUE), probe.getRef());
         LoadSnapshotResult result = probe.expectMsgClass(LoadSnapshotResult.class);
index 5e30b04..254b4fc 100644 (file)
@@ -18,8 +18,8 @@ import static org.opendaylight.controller.cluster.databroker.actors.dds.TestUtil
 import akka.actor.ActorRef;
 import akka.actor.ActorSelection;
 import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.function.Function;
@@ -108,7 +108,7 @@ public abstract class AbstractClientHandleTest<T extends AbstractClientHandle<Ab
 
     @After
     public void tearDown() throws Exception {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
     }
 
     @Test
index 57cf9fb..8a5b3f5 100644 (file)
@@ -16,8 +16,8 @@ import akka.actor.ActorRef;
 import akka.actor.ActorSelection;
 import akka.actor.ActorSystem;
 import akka.actor.Status;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
 import java.util.Collections;
 import java.util.Optional;
 import org.junit.After;
@@ -66,7 +66,7 @@ public abstract class AbstractDataStoreClientBehaviorTest {
 
     @After
     public void tearDown() throws Exception {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
     }
 
     @Test
index fc11117..00a4709 100644 (file)
@@ -15,8 +15,8 @@ import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.base.Ticker;
 import com.google.common.primitives.UnsignedLong;
 import java.util.ArrayList;
@@ -118,7 +118,7 @@ public abstract class AbstractProxyTransactionTest<T extends AbstractProxyTransa
 
     @After
     public void tearDown() throws Exception {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
     }
 
     @Test
index 158b408..963b366 100644 (file)
@@ -10,8 +10,8 @@ package org.opendaylight.controller.cluster.databroker.actors.dds;
 import static org.opendaylight.controller.cluster.databroker.actors.dds.TestUtils.CLIENT_ID;
 
 import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -53,7 +53,7 @@ public class ClientLocalHistoryTest extends AbstractClientHistoryTest<ClientLoca
 
     @After
     public void tearDown() throws Exception {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
     }
 
     @Override
index 1b90e4b..b30986e 100644 (file)
@@ -14,8 +14,8 @@ import static org.opendaylight.controller.cluster.databroker.actors.dds.TestUtil
 import static org.opendaylight.controller.cluster.databroker.actors.dds.TestUtils.getWithTimeout;
 
 import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.primitives.UnsignedLong;
 import com.google.common.util.concurrent.ListenableFuture;
 import java.util.ArrayList;
@@ -79,13 +79,13 @@ public class ClientTransactionCommitCohortTest {
 
     @After
     public void tearDown() throws Exception {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
     }
 
     @Test
     public void testCanCommit() throws Exception {
         testOpSuccess(ClientTransactionCommitCohort::canCommit, this::expectCanCommit,
-                this::replyCanCommitSuccess, true);
+                this::replyCanCommitSuccess, Boolean.TRUE);
     }
 
     @Test
index b26e86a..acde5f5 100644 (file)
@@ -14,8 +14,8 @@ import static org.opendaylight.controller.cluster.databroker.actors.dds.TestUtil
 import static org.opendaylight.controller.cluster.databroker.actors.dds.TestUtils.getWithTimeout;
 
 import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.primitives.UnsignedLong;
 import com.google.common.util.concurrent.ListenableFuture;
 import java.util.Optional;
@@ -59,7 +59,7 @@ public class DirectTransactionCommitCohortTest {
 
     @After
     public void tearDown() throws Exception {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
     }
 
     @Test
index f86f806..c2464e7 100644 (file)
@@ -13,8 +13,8 @@ import static org.mockito.Mockito.when;
 import akka.actor.ActorRef;
 import akka.actor.ActorSelection;
 import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
 import java.util.Collections;
 import java.util.concurrent.CompletionStage;
 import java.util.concurrent.ExecutionException;
@@ -74,7 +74,7 @@ public class ModuleShardBackendResolverTest {
 
     @After
     public void tearDown() throws Exception {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
     }
 
     @Test
index 72e434a..329862a 100644 (file)
@@ -10,8 +10,8 @@ package org.opendaylight.controller.cluster.databroker.actors.dds;
 import static org.opendaylight.controller.cluster.databroker.actors.dds.TestUtils.CLIENT_ID;
 
 import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -51,7 +51,7 @@ public class SingleClientHistoryTest extends AbstractClientHistoryTest<SingleCli
 
     @After
     public void tearDown() throws Exception {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
     }
 
     @Override
index 851bec6..7c2255e 100644 (file)
@@ -9,7 +9,7 @@
 package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import java.io.IOException;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -25,7 +25,7 @@ public abstract class AbstractActorTest extends AbstractTest {
 
     @AfterClass
     public static void tearDownClass() throws IOException {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
         system = null;
     }
 
index 62f01aa..a9f7593 100644 (file)
@@ -9,7 +9,7 @@
 package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import com.typesafe.config.ConfigFactory;
 import java.io.IOException;
 import org.junit.AfterClass;
@@ -26,7 +26,7 @@ public abstract class AbstractClusterRefActorTest extends AbstractTest {
 
     @AfterClass
     public static void tearDownClass() throws IOException {
-        JavaTestKit.shutdownActorSystem(system, null, Boolean.TRUE);
+        TestKit.shutdownActorSystem(system, Boolean.TRUE);
         system = null;
     }
 
index 790c5c7..e57ae8f 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import com.typesafe.config.ConfigFactory;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -61,11 +61,11 @@ public abstract class AbstractTest {
     @After
     public void actorSystemCleanup() {
         for (final ActorSystem system : actorSystems) {
-            JavaTestKit.shutdownActorSystem(system, null, Boolean.TRUE);
+            TestKit.shutdownActorSystem(system, Boolean.TRUE);
         }
     }
 
-    protected ActorSystem newActorSystem(String name, String config) {
+    protected ActorSystem newActorSystem(final String name, final String config) {
         ActorSystem system = ActorSystem.create(name, ConfigFactory.load().getConfig(config));
         actorSystems.add(system);
         return system;
index 894e7df..afa4627 100644 (file)
@@ -23,7 +23,7 @@ import akka.actor.ActorSelection;
 import akka.actor.ActorSystem;
 import akka.actor.Props;
 import akka.dispatch.Futures;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import akka.util.Timeout;
 import com.codahale.metrics.MetricRegistry;
 import com.codahale.metrics.Timer;
@@ -165,7 +165,7 @@ public abstract class AbstractTransactionProxyTest extends AbstractTest {
 
     @AfterClass
     public static void tearDownClass() throws IOException {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
         system = null;
     }
 
index 112dce5..26b9aa3 100644 (file)
@@ -19,7 +19,7 @@ import akka.actor.Props;
 import akka.actor.Terminated;
 import akka.dispatch.ExecutionContexts;
 import akka.dispatch.Futures;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import akka.util.Timeout;
 import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.Uninterruptibles;
@@ -71,7 +71,7 @@ public class DataChangeListenerRegistrationProxyTest extends AbstractActorTest {
 
     @Test(timeout = 10000)
     public void testSuccessfulRegistration() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 ActorContext actorContext = new ActorContext(getSystem(), getRef(),
                         mock(ClusterWrapper.class), mock(Configuration.class));
@@ -122,7 +122,7 @@ public class DataChangeListenerRegistrationProxyTest extends AbstractActorTest {
 
     @Test(timeout = 10000)
     public void testSuccessfulRegistrationForClusteredListener() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 ActorContext actorContext = new ActorContext(getSystem(), getRef(),
                     mock(ClusterWrapper.class), mock(Configuration.class));
@@ -176,7 +176,7 @@ public class DataChangeListenerRegistrationProxyTest extends AbstractActorTest {
 
     @Test(timeout = 10000)
     public void testLocalShardNotFound() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 ActorContext actorContext = new ActorContext(getSystem(), getRef(),
                         mock(ClusterWrapper.class), mock(Configuration.class));
@@ -203,7 +203,7 @@ public class DataChangeListenerRegistrationProxyTest extends AbstractActorTest {
 
     @Test(timeout = 10000)
     public void testLocalShardNotInitialized() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 ActorContext actorContext = new ActorContext(getSystem(), getRef(),
                         mock(ClusterWrapper.class), mock(Configuration.class));
@@ -221,13 +221,7 @@ public class DataChangeListenerRegistrationProxyTest extends AbstractActorTest {
 
                 reply(new NotInitializedException("not initialized"));
 
-                new Within(duration("1 seconds")) {
-                    @Override
-                    protected void run() {
-                        expectNoMsg();
-                    }
-                };
-
+                expectNoMsg(duration("1 seconds"));
                 proxy.close();
             }
         };
@@ -235,7 +229,7 @@ public class DataChangeListenerRegistrationProxyTest extends AbstractActorTest {
 
     @Test
     public void testFailedRegistration() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 ActorSystem mockActorSystem = mock(ActorSystem.class);
 
@@ -274,7 +268,7 @@ public class DataChangeListenerRegistrationProxyTest extends AbstractActorTest {
 
     @Test
     public void testCloseBeforeRegistration() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 ActorContext actorContext = mock(ActorContext.class);
 
index a2e6b11..5d120f5 100644 (file)
@@ -13,7 +13,7 @@ import static org.opendaylight.controller.md.cluster.datastore.model.TestModel.T
 import akka.actor.ActorRef;
 import akka.actor.DeadLetter;
 import akka.actor.Props;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import org.junit.Assert;
 import org.junit.Test;
 import org.mockito.Mockito;
@@ -28,7 +28,7 @@ public class DataChangeListenerTest extends AbstractActorTest {
     @SuppressWarnings({ "rawtypes", "unchecked" })
     @Test
     public void testDataChangedWhenNotificationsAreEnabled() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final AsyncDataChangeEvent mockChangeEvent = Mockito.mock(AsyncDataChangeEvent.class);
                 final AsyncDataChangeListener mockListener = Mockito.mock(AsyncDataChangeListener.class);
@@ -51,7 +51,7 @@ public class DataChangeListenerTest extends AbstractActorTest {
     @SuppressWarnings({ "rawtypes", "unchecked" })
     @Test
     public void testDataChangedWhenNotificationsAreDisabled() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final AsyncDataChangeEvent mockChangeEvent = Mockito.mock(AsyncDataChangeEvent.class);
                 final AsyncDataChangeListener mockListener = Mockito.mock(AsyncDataChangeListener.class);
@@ -60,15 +60,12 @@ public class DataChangeListenerTest extends AbstractActorTest {
 
                 subject.tell(new DataChanged(mockChangeEvent), getRef());
 
-                new Within(duration("1 seconds")) {
-                    @Override
-                    protected void run() {
-                        expectNoMsg();
-
-                        Mockito.verify(mockListener, Mockito.never())
-                                .onDataChanged(Mockito.any(AsyncDataChangeEvent.class));
-                    }
-                };
+                within(duration("1 seconds"), () -> {
+                    expectNoMsg();
+                    Mockito.verify(mockListener, Mockito.never())
+                        .onDataChanged(Mockito.any(AsyncDataChangeEvent.class));
+                    return null;
+                });
             }
         };
     }
@@ -76,7 +73,7 @@ public class DataChangeListenerTest extends AbstractActorTest {
     @SuppressWarnings({ "rawtypes", "unchecked" })
     @Test
     public void testDataChangedWithNoSender() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final AsyncDataChangeEvent mockChangeEvent = Mockito.mock(AsyncDataChangeEvent.class);
                 final AsyncDataChangeListener mockListener = Mockito.mock(AsyncDataChangeListener.class);
@@ -108,7 +105,7 @@ public class DataChangeListenerTest extends AbstractActorTest {
     @SuppressWarnings({ "rawtypes", "unchecked" })
     @Test
     public void testDataChangedWithListenerRuntimeEx() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final AsyncDataChangeEvent mockChangeEvent1 = Mockito.mock(AsyncDataChangeEvent.class);
                 final AsyncDataChangeEvent mockChangeEvent2 = Mockito.mock(AsyncDataChangeEvent.class);
index a98d55a..7316eef 100644 (file)
@@ -12,7 +12,7 @@ import static org.opendaylight.controller.md.cluster.datastore.model.TestModel.T
 import akka.actor.ActorRef;
 import akka.actor.DeadLetter;
 import akka.actor.Props;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.collect.ImmutableList;
 import org.junit.Assert;
 import org.junit.Test;
@@ -28,7 +28,7 @@ public class DataTreeChangeListenerActorTest extends AbstractActorTest {
 
     @Test
     public void testDataChangedWhenNotificationsAreEnabled() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final DataTreeCandidate mockTreeCandidate = Mockito.mock(DataTreeCandidate.class);
                 final ImmutableList<DataTreeCandidate> mockCandidates = ImmutableList.of(mockTreeCandidate);
@@ -51,7 +51,7 @@ public class DataTreeChangeListenerActorTest extends AbstractActorTest {
 
     @Test
     public void testDataChangedWhenNotificationsAreDisabled() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final DataTreeCandidate mockTreeCandidate = Mockito.mock(DataTreeCandidate.class);
                 final ImmutableList<DataTreeCandidate> mockCandidates = ImmutableList.of(mockTreeCandidate);
@@ -61,22 +61,19 @@ public class DataTreeChangeListenerActorTest extends AbstractActorTest {
 
                 subject.tell(new DataTreeChanged(mockCandidates), getRef());
 
-                new Within(duration("1 seconds")) {
-                    @Override
-                    protected void run() {
-                        expectNoMsg();
-
-                        Mockito.verify(mockListener, Mockito.never())
-                                .onDataTreeChanged(Matchers.anyCollectionOf(DataTreeCandidate.class));
-                    }
-                };
+                within(duration("1 seconds"), () -> {
+                    expectNoMsg();
+                    Mockito.verify(mockListener, Mockito.never())
+                        .onDataTreeChanged(Matchers.anyCollectionOf(DataTreeCandidate.class));
+                    return null;
+                });
             }
         };
     }
 
     @Test
     public void testDataChangedWithNoSender() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final DataTreeCandidate mockTreeCandidate = Mockito.mock(DataTreeCandidate.class);
                 final ImmutableList<DataTreeCandidate> mockCandidates = ImmutableList.of(mockTreeCandidate);
@@ -109,7 +106,7 @@ public class DataTreeChangeListenerActorTest extends AbstractActorTest {
 
     @Test
     public void testDataChangedWithListenerRuntimeEx() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final DataTreeCandidate mockTreeCandidate1 = Mockito.mock(DataTreeCandidate.class);
                 final ImmutableList<DataTreeCandidate> mockCandidates1 = ImmutableList.of(mockTreeCandidate1);
index 2b99bfa..7b23260 100644 (file)
@@ -19,7 +19,7 @@ import akka.actor.Props;
 import akka.actor.Terminated;
 import akka.dispatch.ExecutionContexts;
 import akka.dispatch.Futures;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import akka.util.Timeout;
 import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.Uninterruptibles;
@@ -51,7 +51,7 @@ public class DataTreeChangeListenerProxyTest extends AbstractActorTest {
 
     @Test(timeout = 10000)
     public void testSuccessfulRegistration() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 ActorContext actorContext = new ActorContext(getSystem(), getRef(), mock(ClusterWrapper.class),
                         mock(Configuration.class));
@@ -101,7 +101,7 @@ public class DataTreeChangeListenerProxyTest extends AbstractActorTest {
 
     @Test(timeout = 10000)
     public void testSuccessfulRegistrationForClusteredListener() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 ActorContext actorContext = new ActorContext(getSystem(), getRef(), mock(ClusterWrapper.class),
                         mock(Configuration.class));
@@ -133,7 +133,7 @@ public class DataTreeChangeListenerProxyTest extends AbstractActorTest {
 
     @Test(timeout = 10000)
     public void testLocalShardNotFound() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 ActorContext actorContext = new ActorContext(getSystem(), getRef(), mock(ClusterWrapper.class),
                         mock(Configuration.class));
@@ -159,7 +159,7 @@ public class DataTreeChangeListenerProxyTest extends AbstractActorTest {
 
     @Test(timeout = 10000)
     public void testLocalShardNotInitialized() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 ActorContext actorContext = new ActorContext(getSystem(), getRef(), mock(ClusterWrapper.class),
                         mock(Configuration.class));
@@ -176,12 +176,10 @@ public class DataTreeChangeListenerProxyTest extends AbstractActorTest {
 
                 reply(new NotInitializedException("not initialized"));
 
-                new Within(duration("1 seconds")) {
-                    @Override
-                    protected void run() {
-                        expectNoMsg();
-                    }
-                };
+                within(duration("1 seconds"), () ->  {
+                    expectNoMsg();
+                    return null;
+                });
 
                 proxy.close();
             }
@@ -190,7 +188,7 @@ public class DataTreeChangeListenerProxyTest extends AbstractActorTest {
 
     @Test
     public void testFailedRegistration() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 ActorSystem mockActorSystem = mock(ActorSystem.class);
 
@@ -226,7 +224,7 @@ public class DataTreeChangeListenerProxyTest extends AbstractActorTest {
 
     @Test
     public void testCloseBeforeRegistration() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 ActorContext actorContext = mock(ActorContext.class);
 
index 3278ff6..0a435fe 100644 (file)
@@ -23,8 +23,8 @@ import static org.opendaylight.controller.md.cluster.datastore.model.TestModel.t
 import akka.actor.ActorRef;
 import akka.actor.ActorSelection;
 import akka.pattern.Patterns;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
 import akka.util.Timeout;
 import java.util.AbstractMap.SimpleEntry;
 import java.util.Map.Entry;
@@ -91,9 +91,9 @@ public class DataTreeChangeListenerSupportTest extends AbstractShardTest {
         listener.verifyNotifiedData(TEST_PATH);
 
         listener.reset(1);
-        JavaTestKit kit = new JavaTestKit(getSystem());
+        TestKit kit = new TestKit(getSystem());
         entry.getValue().tell(CloseDataTreeNotificationListenerRegistration.getInstance(), kit.getRef());
-        kit.expectMsgClass(JavaTestKit.duration("5 seconds"), CloseDataTreeNotificationListenerRegistrationReply.class);
+        kit.expectMsgClass(kit.duration("5 seconds"), CloseDataTreeNotificationListenerRegistrationReply.class);
 
         writeToStore(shard.getDataStore(), TEST_PATH, ImmutableNodes.containerNode(TEST_QNAME));
         listener.verifyNoNotifiedData(TEST_PATH);
index 73a6c74..5a131cd 100644 (file)
@@ -23,7 +23,7 @@ import akka.actor.ActorSystem;
 import akka.actor.Address;
 import akka.actor.AddressFromURIString;
 import akka.cluster.Cluster;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.base.Optional;
 import com.google.common.base.Throwables;
 import com.google.common.util.concurrent.CheckedFuture;
@@ -84,7 +84,7 @@ public class DataTreeCohortIntegrationTest {
 
     @AfterClass
     public static void tearDownClass() throws IOException {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
         system = null;
     }
 
@@ -259,8 +259,8 @@ public class DataTreeCohortIntegrationTest {
     }
 
     @SuppressWarnings("rawtypes")
-    private static DOMDataTreeCandidate findCandidate(ArgumentCaptor<Collection> candidateCapture,
-            YangInstanceIdentifier rootPath) {
+    private static DOMDataTreeCandidate findCandidate(final ArgumentCaptor<Collection> candidateCapture,
+            final YangInstanceIdentifier rootPath) {
         for (Object obj: candidateCapture.getValue()) {
             DOMDataTreeCandidate candidate = (DOMDataTreeCandidate)obj;
             if (rootPath.equals(candidate.getRootPath().getRootIdentifier())) {
@@ -307,9 +307,9 @@ public class DataTreeCohortIntegrationTest {
         }
     }
 
-    private static void assertDataTreeCandidate(DOMDataTreeCandidate candidate, DOMDataTreeIdentifier expTreeId,
-            ModificationType expType, Optional<NormalizedNode<?, ?>> expDataAfter,
-            Optional<NormalizedNode<?, ?>> expDataBefore) {
+    private static void assertDataTreeCandidate(final DOMDataTreeCandidate candidate,
+            final DOMDataTreeIdentifier expTreeId, final ModificationType expType,
+            final Optional<NormalizedNode<?, ?>> expDataAfter, final Optional<NormalizedNode<?, ?>> expDataBefore) {
         assertNotNull("Expected candidate for path " + expTreeId.getRootIdentifier(), candidate);
         assertEquals("rootPath", expTreeId, candidate.getRootPath());
         assertEquals("modificationType", expType, candidate.getRootNode().getModificationType());
index 0b97772..d079868 100644 (file)
@@ -21,7 +21,7 @@ import akka.actor.ActorSystem;
 import akka.actor.Address;
 import akka.actor.AddressFromURIString;
 import akka.cluster.Cluster;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.base.Optional;
 import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableMap;
@@ -124,7 +124,7 @@ public class DistributedDataStoreIntegrationTest {
 
     @After
     public void tearDown() throws IOException {
-        JavaTestKit.shutdownActorSystem(system, null, Boolean.TRUE);
+        TestKit.shutdownActorSystem(system, Boolean.TRUE);
         system = null;
     }
 
index b78d017..c09111e 100644 (file)
@@ -24,7 +24,7 @@ import akka.actor.AddressFromURIString;
 import akka.cluster.Cluster;
 import akka.dispatch.Futures;
 import akka.pattern.Patterns;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.base.Optional;
 import com.google.common.base.Stopwatch;
 import com.google.common.base.Supplier;
@@ -182,9 +182,9 @@ public class DistributedDataStoreRemotingIntegrationTest extends AbstractTest {
             leaderDistributedDataStore.close();
         }
 
-        JavaTestKit.shutdownActorSystem(leaderSystem);
-        JavaTestKit.shutdownActorSystem(followerSystem);
-        JavaTestKit.shutdownActorSystem(follower2System);
+        TestKit.shutdownActorSystem(leaderSystem);
+        TestKit.shutdownActorSystem(followerSystem);
+        TestKit.shutdownActorSystem(follower2System);
 
         InMemoryJournal.clear();
         InMemorySnapshotStore.clear();
@@ -316,8 +316,8 @@ public class DistributedDataStoreRemotingIntegrationTest extends AbstractTest {
             Uninterruptibles.sleepUninterruptibly(50, TimeUnit.MILLISECONDS);
         }
 
-        JavaTestKit.shutdownActorSystem(leaderSystem, null, Boolean.TRUE);
-        JavaTestKit.shutdownActorSystem(followerSystem, null, Boolean.TRUE);
+        TestKit.shutdownActorSystem(leaderSystem, Boolean.TRUE);
+        TestKit.shutdownActorSystem(followerSystem, Boolean.TRUE);
 
         final ActorSystem newSystem = newActorSystem("reinstated-member2", "Member2");
 
@@ -599,7 +599,7 @@ public class DistributedDataStoreRemotingIntegrationTest extends AbstractTest {
         sendDatastoreContextUpdate(followerDistributedDataStore, followerDatastoreContextBuilder
                 .shardElectionTimeoutFactor(1).customRaftPolicyImplementation(null));
 
-        JavaTestKit.shutdownActorSystem(leaderSystem, null, true);
+        TestKit.shutdownActorSystem(leaderSystem, true);
         Cluster.get(followerSystem).leave(MEMBER_1_ADDRESS);
 
         followerTestKit.waitUntilNoLeader(followerDistributedDataStore.getActorContext(), CARS);
@@ -1011,7 +1011,7 @@ public class DistributedDataStoreRemotingIntegrationTest extends AbstractTest {
 
         // Shutdown the leader and try to create a new tx.
 
-        JavaTestKit.shutdownActorSystem(leaderSystem, null, true);
+        TestKit.shutdownActorSystem(leaderSystem, true);
 
         followerDatastoreContextBuilder.operationTimeoutInMillis(50).shardElectionTimeoutFactor(1);
         sendDatastoreContextUpdate(followerDistributedDataStore, followerDatastoreContextBuilder);
@@ -1046,7 +1046,7 @@ public class DistributedDataStoreRemotingIntegrationTest extends AbstractTest {
 
         // Shutdown the leader and try to create a new tx.
 
-        JavaTestKit.shutdownActorSystem(leaderSystem, null, true);
+        TestKit.shutdownActorSystem(leaderSystem, true);
 
         Cluster.get(followerSystem).leave(MEMBER_1_ADDRESS);
 
@@ -1097,7 +1097,7 @@ public class DistributedDataStoreRemotingIntegrationTest extends AbstractTest {
 
             // Shutdown the leader and try to create a new tx.
 
-            JavaTestKit.shutdownActorSystem(leaderSystem, null, true);
+            TestKit.shutdownActorSystem(leaderSystem, true);
 
             Cluster.get(followerSystem).leave(MEMBER_1_ADDRESS);
 
index 8e391cb..344ec10 100644 (file)
@@ -13,8 +13,8 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 
 import akka.actor.ActorRef;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
 import org.junit.Test;
 import org.opendaylight.controller.cluster.notifications.LeaderStateChanged;
 import org.opendaylight.controller.cluster.notifications.RegisterRoleChangeListener;
@@ -29,7 +29,7 @@ public class RoleChangeNotifierTest extends AbstractActorTest {
 
     @Test
     public void testHandleRegisterRoleChangeListener() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 String memberId = "testHandleRegisterRoleChangeListener";
                 ActorRef listenerActor = getSystem().actorOf(MessageCollectorActor.props());
@@ -52,7 +52,7 @@ public class RoleChangeNotifierTest extends AbstractActorTest {
 
     @Test
     public void testHandleRaftRoleChanged() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 String memberId = "testHandleRegisterRoleChangeListenerWithNotificationSet";
                 ActorRef listenerActor = getSystem().actorOf(MessageCollectorActor.props());
@@ -89,7 +89,7 @@ public class RoleChangeNotifierTest extends AbstractActorTest {
 
     @Test
     public void testHandleLeaderStateChanged() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 String actorId = "testHandleLeaderStateChanged";
                 TestActorRef<RoleChangeNotifier> notifierTestActorRef = TestActorRef.create(getSystem(),
index 4e08f4a..df1359f 100644 (file)
@@ -29,11 +29,11 @@ import scala.concurrent.duration.FiniteDuration;
 public class ShardTestKit extends JavaTestKit {
     private static final Logger LOG = LoggerFactory.getLogger(ShardTestKit.class);
 
-    public ShardTestKit(ActorSystem actorSystem) {
+    public ShardTestKit(final ActorSystem actorSystem) {
         super(actorSystem);
     }
 
-    public void waitForLogMessage(final Class<?> logLevel, ActorRef subject, String logMessage) {
+    public void waitForLogMessage(final Class<?> logLevel, final ActorRef subject, final String logMessage) {
         // Wait for a specific log message to show up
         final boolean result =
             new JavaTestKit.EventFilter<Boolean>(logLevel
@@ -51,7 +51,7 @@ public class ShardTestKit extends JavaTestKit {
     }
 
     @SuppressWarnings("checkstyle:IllegalCatch")
-    public static String waitUntilLeader(ActorRef shard) {
+    public static String waitUntilLeader(final ActorRef shard) {
         FiniteDuration duration = Duration.create(100, TimeUnit.MILLISECONDS);
         for (int i = 0; i < 20 * 5; i++) {
             Future<Object> future = Patterns.ask(shard, FindLeader.INSTANCE, new Timeout(duration));
@@ -75,7 +75,7 @@ public class ShardTestKit extends JavaTestKit {
     }
 
     @SuppressWarnings("checkstyle:IllegalCatch")
-    public void waitUntilNoLeader(ActorRef shard) {
+    public void waitUntilNoLeader(final ActorRef shard) {
         FiniteDuration duration = Duration.create(100, TimeUnit.MILLISECONDS);
         Object lastResponse = null;
         for (int i = 0; i < 20 * 5; i++) {
index 0d65faa..f3acf29 100644 (file)
@@ -19,8 +19,8 @@ import akka.actor.Props;
 import akka.actor.Status.Failure;
 import akka.actor.Terminated;
 import akka.dispatch.Dispatchers;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.base.Throwables;
 import java.util.concurrent.TimeUnit;
 import org.junit.Before;
@@ -95,7 +95,7 @@ public class ShardTransactionTest extends AbstractActorTest {
 
     @Test
     public void testOnReceiveReadData() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 testOnReceiveReadData(newTransactionActor(RO, readOnlyTransaction(), "testReadDataRO"));
 
@@ -115,7 +115,7 @@ public class ShardTransactionTest extends AbstractActorTest {
 
     @Test
     public void testOnReceiveReadDataWhenDataNotFound() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 testOnReceiveReadDataWhenDataNotFound(
                         newTransactionActor(RO, readOnlyTransaction(), "testReadDataWhenDataNotFoundRO"));
@@ -136,7 +136,7 @@ public class ShardTransactionTest extends AbstractActorTest {
 
     @Test
     public void testOnReceiveDataExistsPositive() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 testOnReceiveDataExistsPositive(
                         newTransactionActor(RO, readOnlyTransaction(), "testDataExistsPositiveRO"));
@@ -158,7 +158,7 @@ public class ShardTransactionTest extends AbstractActorTest {
 
     @Test
     public void testOnReceiveDataExistsNegative() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 testOnReceiveDataExistsNegative(
                         newTransactionActor(RO, readOnlyTransaction(), "testDataExistsNegativeRO"));
@@ -179,7 +179,7 @@ public class ShardTransactionTest extends AbstractActorTest {
 
     @Test
     public void testOnReceiveBatchedModifications() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 ShardDataTreeTransactionParent parent = Mockito.mock(ShardDataTreeTransactionParent.class);
                 DataTreeModification mockModification = Mockito.mock(DataTreeModification.class);
@@ -221,12 +221,12 @@ public class ShardTransactionTest extends AbstractActorTest {
 
     @Test
     public void testOnReceiveBatchedModificationsReadyWithoutImmediateCommit() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final ActorRef transaction = newTransactionActor(WO, readWriteTransaction(),
                         "testOnReceiveBatchedModificationsReadyWithoutImmediateCommit");
 
-                JavaTestKit watcher = new JavaTestKit(getSystem());
+                TestKit watcher = new TestKit(getSystem());
                 watcher.watch(transaction);
 
                 YangInstanceIdentifier writePath = TestModel.TEST_PATH;
@@ -256,12 +256,12 @@ public class ShardTransactionTest extends AbstractActorTest {
 
     @Test
     public void testOnReceiveBatchedModificationsReadyWithImmediateCommit() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final ActorRef transaction = newTransactionActor(WO, readWriteTransaction(),
                         "testOnReceiveBatchedModificationsReadyWithImmediateCommit");
 
-                JavaTestKit watcher = new JavaTestKit(getSystem());
+                TestKit watcher = new TestKit(getSystem());
                 watcher.watch(transaction);
 
                 YangInstanceIdentifier writePath = TestModel.TEST_PATH;
@@ -285,7 +285,7 @@ public class ShardTransactionTest extends AbstractActorTest {
 
     @Test(expected = TestException.class)
     public void testOnReceiveBatchedModificationsFailure() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
 
                 ShardDataTreeTransactionParent parent = Mockito.mock(ShardDataTreeTransactionParent.class);
@@ -295,7 +295,7 @@ public class ShardTransactionTest extends AbstractActorTest {
                 final ActorRef transaction = newTransactionActor(RW, mockWriteTx,
                         "testOnReceiveBatchedModificationsFailure");
 
-                JavaTestKit watcher = new JavaTestKit(getSystem());
+                TestKit watcher = new TestKit(getSystem());
                 watcher.watch(transaction);
 
                 YangInstanceIdentifier path = TestModel.TEST_PATH;
@@ -328,13 +328,13 @@ public class ShardTransactionTest extends AbstractActorTest {
 
     @Test(expected = IllegalStateException.class)
     public void testOnReceiveBatchedModificationsReadyWithIncorrectTotalMessageCount() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
 
                 final ActorRef transaction = newTransactionActor(WO, readWriteTransaction(),
                         "testOnReceiveBatchedModificationsReadyWithIncorrectTotalMessageCount");
 
-                JavaTestKit watcher = new JavaTestKit(getSystem());
+                TestKit watcher = new TestKit(getSystem());
                 watcher.watch(transaction);
 
                 BatchedModifications batched = new BatchedModifications(nextTransactionId(),
@@ -358,7 +358,7 @@ public class ShardTransactionTest extends AbstractActorTest {
 
     @Test
     public void testReadWriteTxOnReceiveCloseTransaction() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final ActorRef transaction = newTransactionActor(RW, readWriteTransaction(),
                         "testReadWriteTxOnReceiveCloseTransaction");
@@ -375,7 +375,7 @@ public class ShardTransactionTest extends AbstractActorTest {
 
     @Test
     public void testWriteOnlyTxOnReceiveCloseTransaction() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final ActorRef transaction = newTransactionActor(WO, readWriteTransaction(),
                         "testWriteTxOnReceiveCloseTransaction");
@@ -392,7 +392,7 @@ public class ShardTransactionTest extends AbstractActorTest {
 
     @Test
     public void testReadOnlyTxOnReceiveCloseTransaction() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final ActorRef transaction = newTransactionActor(TransactionType.READ_ONLY, readOnlyTransaction(),
                         "testReadOnlyTxOnReceiveCloseTransaction");
@@ -411,7 +411,7 @@ public class ShardTransactionTest extends AbstractActorTest {
         datastoreContext = DatastoreContext.newBuilder().shardTransactionIdleTimeout(
                 500, TimeUnit.MILLISECONDS).build();
 
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final ActorRef transaction = newTransactionActor(RW, readWriteTransaction(),
                         "testShardTransactionInactivity");
index 12428e9..0ae15d6 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.controller.cluster.datastore.actors;
 import static org.mockito.Mockito.timeout;
 
 import akka.actor.ActorRef;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
@@ -36,7 +36,7 @@ public class DataTreeNotificationListenerRegistrationActorTest extends AbstractA
 
     @Test
     public void testOnReceiveCloseListenerRegistrationAfterSetRegistration() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final ActorRef subject = getSystem().actorOf(DataTreeNotificationListenerRegistrationActor.props(),
                         "testOnReceiveCloseListenerRegistrationAfterSetRegistration");
@@ -58,7 +58,7 @@ public class DataTreeNotificationListenerRegistrationActorTest extends AbstractA
 
     @Test
     public void testOnReceiveCloseListenerRegistrationBeforeSetRegistration() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final ActorRef subject = getSystem().actorOf(DataTreeNotificationListenerRegistrationActor.props(),
                         "testOnReceiveSetRegistrationAfterPriorClose");
@@ -80,7 +80,7 @@ public class DataTreeNotificationListenerRegistrationActorTest extends AbstractA
 
     @Test
     public void testOnReceiveSetRegistrationAfterPriorClose() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 DataTreeNotificationListenerRegistrationActor.killDelay = 1000;
                 final ListenerRegistration<?> mockListenerReg2 = Mockito.mock(ListenerRegistration.class);
index f3660da..e77ab03 100644 (file)
@@ -11,7 +11,7 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
 import akka.actor.ActorRef;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.ObjectInputStream;
@@ -31,7 +31,7 @@ public class ShardSnapshotActorTest extends AbstractActorTest {
 
     private static void testSerializeSnapshot(final String testName, final ShardDataTreeSnapshot snapshot,
             final boolean withInstallSnapshot) throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final ActorRef snapshotActor = getSystem().actorOf(ShardSnapshotActor.props(), testName);
                 watch(snapshotActor);
index ae4740d..c7013e8 100644 (file)
@@ -9,7 +9,7 @@
 package org.opendaylight.controller.cluster.datastore.entityownership;
 
 import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import com.typesafe.config.ConfigFactory;
 import java.io.IOException;
 import org.junit.AfterClass;
@@ -26,7 +26,7 @@ public class AbstractClusterRefEntityOwnershipTest extends AbstractEntityOwnersh
 
     @AfterClass
     public static void tearDownClass() throws IOException {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
         system = null;
     }
 
index b22ed37..bc2f611 100644 (file)
@@ -13,7 +13,7 @@ import static org.opendaylight.controller.cluster.datastore.entityownership.Enti
 import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.entityOwnersWithCandidate;
 import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.entityPath;
 
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.collect.ImmutableSet;
 import java.util.concurrent.TimeUnit;
 import org.junit.Before;
@@ -58,7 +58,7 @@ public class CandidateListChangeListenerTest extends AbstractActorTest {
 
     @Test
     public void testOnDataTreeChanged() throws Exception {
-        JavaTestKit kit = new JavaTestKit(getSystem());
+        TestKit kit = new TestKit(getSystem());
 
         new CandidateListChangeListener(kit.getRef(), "test").init(shardDataTree);
 
index d040eb6..9bdacd7 100644 (file)
@@ -28,7 +28,6 @@ import akka.actor.Status.Failure;
 import akka.actor.Status.Success;
 import akka.cluster.Cluster;
 import akka.pattern.Patterns;
-import akka.testkit.JavaTestKit;
 import akka.util.Timeout;
 import com.google.common.base.Optional;
 import com.google.common.base.Stopwatch;
@@ -614,7 +613,7 @@ public class DistributedEntityOwnershipIntegrationTest {
         AddShardReplica addReplica = new AddShardReplica(ENTITY_OWNERSHIP_SHARD_NAME);
         follower1DistributedDataStore.getActorContext().getShardManager().tell(addReplica,
                 follower1Node.kit().getRef());
-        Object reply = follower1Node.kit().expectMsgAnyClassOf(JavaTestKit.duration("5 sec"),
+        Object reply = follower1Node.kit().expectMsgAnyClassOf(follower1Node.kit().duration("5 sec"),
                 Success.class, Failure.class);
         if (reply instanceof Failure) {
             throw new AssertionError("AddShardReplica failed", ((Failure)reply).cause());
index dc40f0f..c806d1d 100644 (file)
@@ -18,8 +18,8 @@ import static org.mockito.Mockito.verify;
 import akka.actor.ActorContext;
 import akka.actor.ActorRef;
 import akka.actor.Props;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.util.concurrent.Uninterruptibles;
 import java.util.ArrayList;
 import java.util.List;
@@ -127,9 +127,9 @@ public class EntityOwnershipListenerSupportTest extends AbstractEntityOwnershipT
 
         // Unregister all listeners and verify their listener actors are destroyed.
 
-        List<JavaTestKit> watchers = new ArrayList<>();
+        List<TestKit> watchers = new ArrayList<>();
         for (Iterator<ActorRef> iter = listenerActors.iterator(); iter.hasNext();) {
-            JavaTestKit kit = new JavaTestKit(getSystem());
+            TestKit kit = new TestKit(getSystem());
             kit.watch(iter.next());
             watchers.add(kit);
         }
@@ -139,8 +139,8 @@ public class EntityOwnershipListenerSupportTest extends AbstractEntityOwnershipT
         support.removeEntityOwnershipListener(entityType2, mockListener2);
 
         Iterator<ActorRef> iter = listenerActors.iterator();
-        for (JavaTestKit kit: watchers) {
-            kit.expectTerminated(JavaTestKit.duration("3 seconds"), iter.next());
+        for (TestKit kit: watchers) {
+            kit.expectTerminated(kit.duration("3 seconds"), iter.next());
         }
 
         assertEquals("# of listener actors", 0, actorContext.children().size());
index ca104f1..9eb9741 100644 (file)
@@ -26,7 +26,6 @@ import akka.actor.PoisonPill;
 import akka.actor.Props;
 import akka.actor.Terminated;
 import akka.dispatch.Dispatchers;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestActorRef;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.util.concurrent.Uninterruptibles;
@@ -524,7 +523,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
 
         kit.watch(peer2);
         peer2.tell(PoisonPill.getInstance(), ActorRef.noSender());
-        kit.expectMsgClass(JavaTestKit.duration("5 seconds"), Terminated.class);
+        kit.expectMsgClass(kit.duration("5 seconds"), Terminated.class);
         kit.unwatch(peer2);
 
         leader.tell(new PeerDown(peerId2.getMemberName(), peerId2.toString()), ActorRef.noSender());
@@ -591,7 +590,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
 
         kit.watch(peer1);
         peer1.tell(PoisonPill.getInstance(), ActorRef.noSender());
-        kit.expectMsgClass(JavaTestKit.duration("5 seconds"), Terminated.class);
+        kit.expectMsgClass(kit.duration("5 seconds"), Terminated.class);
         kit.unwatch(peer1);
         leader.tell(new PeerDown(peerId1.getMemberName(), peerId1.toString()), ActorRef.noSender());
 
@@ -650,7 +649,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
 
         kit.watch(leader);
         leader.tell(PoisonPill.getInstance(), ActorRef.noSender());
-        kit.expectMsgClass(JavaTestKit.duration("5 seconds"), Terminated.class);
+        kit.expectMsgClass(kit.duration("5 seconds"), Terminated.class);
         kit.unwatch(leader);
         peer2.tell(new PeerDown(leaderId.getMemberName(), leaderId.toString()), ActorRef.noSender());
         peer2.tell(TimeoutNow.INSTANCE, peer2);
index c503184..0f70170 100644 (file)
@@ -12,7 +12,7 @@ import static org.junit.Assert.assertEquals;
 import akka.actor.ActorRef;
 import akka.actor.Status.Failure;
 import akka.actor.Terminated;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
@@ -42,7 +42,7 @@ public class ShardManagerGetSnapshotReplyActorTest extends AbstractActorTest {
 
     @Test
     public void testSuccess() {
-        JavaTestKit kit = new JavaTestKit(getSystem());
+        TestKit kit = new TestKit(getSystem());
 
         List<String> shardList = Arrays.asList("shard1", "shard2", "shard3");
         ShardManagerSnapshot shardManagerSnapshot = new ShardManagerSnapshot(shardList, Collections.emptyMap());
@@ -91,7 +91,7 @@ public class ShardManagerGetSnapshotReplyActorTest extends AbstractActorTest {
 
     @Test
     public void testGetSnapshotFailureReply() {
-        JavaTestKit kit = new JavaTestKit(getSystem());
+        TestKit kit = new TestKit(getSystem());
 
         ActorRef replyActor = getSystem().actorOf(ShardManagerGetSnapshotReplyActor.props(
                 Arrays.asList("shard1", "shard2"), "config", null, kit.getRef(), "shard-manager",
@@ -111,7 +111,7 @@ public class ShardManagerGetSnapshotReplyActorTest extends AbstractActorTest {
 
     @Test
     public void testGetSnapshotTimeout() {
-        JavaTestKit kit = new JavaTestKit(getSystem());
+        TestKit kit = new TestKit(getSystem());
 
         ActorRef replyActor = getSystem().actorOf(ShardManagerGetSnapshotReplyActor.props(
                 Arrays.asList("shard1"), "config", null, kit.getRef(), "shard-manager",
index a23f007..bd387cd 100644 (file)
@@ -35,8 +35,8 @@ import akka.japi.Creator;
 import akka.pattern.Patterns;
 import akka.persistence.RecoveryCompleted;
 import akka.serialization.Serialization;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
 import akka.util.Timeout;
 import com.google.common.base.Function;
 import com.google.common.base.Stopwatch;
@@ -192,7 +192,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
     }
 
     private static void waitForShardInitialized(final ActorRef shardManager, final String shardName,
-            final JavaTestKit kit) {
+            final TestKit kit) {
         AssertionError last = null;
         Stopwatch sw = Stopwatch.createStarted();
         while (sw.elapsed(TimeUnit.SECONDS) <= 5) {
@@ -211,8 +211,8 @@ public class ShardManagerTest extends AbstractShardManagerTest {
     }
 
     @SuppressWarnings("unchecked")
-    private static <T> T expectMsgClassOrFailure(final Class<T> msgClass, final JavaTestKit kit, final String msg) {
-        Object reply = kit.expectMsgAnyClassOf(JavaTestKit.duration("5 sec"), msgClass, Failure.class);
+    private static <T> T expectMsgClassOrFailure(final Class<T> msgClass, final TestKit kit, final String msg) {
+        Object reply = kit.expectMsgAnyClassOf(kit.duration("5 sec"), msgClass, Failure.class);
         if (reply instanceof Failure) {
             throw new AssertionError(msg + " failed", ((Failure)reply).cause());
         }
@@ -287,7 +287,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
             }
         };
 
-        JavaTestKit kit = new JavaTestKit(getSystem());
+        TestKit kit = new TestKit(getSystem());
 
         final ActorRef shardManager = actorFactory.createActor(Props.create(
                 new DelegatingShardManagerCreator(creator)).withDispatcher(Dispatchers.DefaultDispatcherId()));
@@ -324,7 +324,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
 
     @Test
     public void testOnReceiveFindPrimaryForNonExistentShard() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
 
@@ -340,7 +340,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
     @Test
     public void testOnReceiveFindPrimaryForLocalLeaderShard() throws Exception {
         LOG.info("testOnReceiveFindPrimaryForLocalLeaderShard starting");
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 String memberId = "member-1-shard-default-" + shardMrgIDSuffix;
 
@@ -374,7 +374,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
     @Test
     public void testOnReceiveFindPrimaryForNonLocalLeaderShardBeforeMemberUp() throws Exception {
         LOG.info("testOnReceiveFindPrimaryForNonLocalLeaderShardBeforeMemberUp starting");
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
 
@@ -401,7 +401,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
     @Test
     public void testOnReceiveFindPrimaryForNonLocalLeaderShard() throws Exception {
         LOG.info("testOnReceiveFindPrimaryForNonLocalLeaderShard starting");
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
 
@@ -433,7 +433,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
 
     @Test
     public void testOnReceiveFindPrimaryForUninitializedShard() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
 
@@ -446,7 +446,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
 
     @Test
     public void testOnReceiveFindPrimaryForInitializedShardWithNoRole() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
 
@@ -463,7 +463,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
     @Test
     public void testOnReceiveFindPrimaryForFollowerShardWithNoInitialLeaderId() throws Exception {
         LOG.info("testOnReceiveFindPrimaryForFollowerShardWithNoInitialLeaderId starting");
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
 
@@ -500,7 +500,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
     public void testOnReceiveFindPrimaryWaitForShardLeader() throws Exception {
         LOG.info("testOnReceiveFindPrimaryWaitForShardLeader starting");
         datastoreContextBuilder.shardInitializationTimeout(10, TimeUnit.SECONDS);
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
 
@@ -545,7 +545,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
     @Test
     public void testOnReceiveFindPrimaryWaitForReadyWithUninitializedShard() throws Exception {
         LOG.info("testOnReceiveFindPrimaryWaitForReadyWithUninitializedShard starting");
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
 
@@ -567,7 +567,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
     @Test
     public void testOnReceiveFindPrimaryWaitForReadyWithCandidateShard() throws Exception {
         LOG.info("testOnReceiveFindPrimaryWaitForReadyWithCandidateShard starting");
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
 
@@ -588,7 +588,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
     @Test
     public void testOnReceiveFindPrimaryWaitForReadyWithIsolatedLeaderShard() throws Exception {
         LOG.info("testOnReceiveFindPrimaryWaitForReadyWithIsolatedLeaderShard starting");
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
 
@@ -609,7 +609,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
     @Test
     public void testOnReceiveFindPrimaryWaitForReadyWithNoRoleShard() throws Exception {
         LOG.info("testOnReceiveFindPrimaryWaitForReadyWithNoRoleShard starting");
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
 
@@ -657,7 +657,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
                         new ClusterWrapperImpl(system2)).props().withDispatcher(
                                 Dispatchers.DefaultDispatcherId()), shardManagerID);
 
-        new JavaTestKit(system1) {
+        new TestKit(system1) {
             {
                 shardManager1.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
                 shardManager2.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
@@ -731,7 +731,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
                         new ClusterWrapperImpl(system2)).props().withDispatcher(
                                 Dispatchers.DefaultDispatcherId()), shardManagerID);
 
-        new JavaTestKit(system1) {
+        new TestKit(system1) {
             {
                 shardManager1.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
                 shardManager2.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
@@ -855,7 +855,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
                         new ClusterWrapperImpl(system2)).props().withDispatcher(
                                 Dispatchers.DefaultDispatcherId()), shardManagerID);
 
-        new JavaTestKit(system1) {
+        new TestKit(system1) {
             {
                 shardManager1.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
                 shardManager2.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
@@ -955,7 +955,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
                         new ClusterWrapperImpl(system2)).props().withDispatcher(
                                 Dispatchers.DefaultDispatcherId()), shardManagerID);
 
-        new JavaTestKit(system256) {
+        new TestKit(system256) {
             {
                 shardManager256.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
                 shardManager2.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
@@ -1018,7 +1018,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
 
     @Test
     public void testOnReceiveFindLocalShardForNonExistentShard() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
 
@@ -1035,7 +1035,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
 
     @Test
     public void testOnReceiveFindLocalShardForExistentShard() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
 
@@ -1054,7 +1054,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
 
     @Test
     public void testOnReceiveFindLocalShardForNotInitializedShard() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
 
@@ -1068,7 +1068,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
     @Test
     public void testOnReceiveFindLocalShardWaitForShardInitialized() throws Exception {
         LOG.info("testOnReceiveFindLocalShardWaitForShardInitialized starting");
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
 
@@ -1108,7 +1108,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
 
     @Test
     public void testRoleChangeNotificationToFollowerWithShardLeaderStateChangedReleaseReady() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 TestShardManager shardManager = newTestShardManager();
 
@@ -1131,7 +1131,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
 
     @Test
     public void testReadyCountDownForMemberUpAfterLeaderStateChanged() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 TestShardManager shardManager = newTestShardManager();
 
@@ -1266,7 +1266,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
 
     @Test
     public void testOnReceiveSwitchShardBehavior() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
 
@@ -1291,7 +1291,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
     @Test
     public void testOnCreateShard() {
         LOG.info("testOnCreateShard starting");
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 datastoreContextBuilder.shardInitializationTimeout(1, TimeUnit.MINUTES).persistent(true);
 
@@ -1343,7 +1343,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
     @Test
     public void testOnCreateShardWithLocalMemberNotInShardConfig() {
         LOG.info("testOnCreateShardWithLocalMemberNotInShardConfig starting");
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 datastoreContextBuilder.shardInitializationTimeout(1, TimeUnit.MINUTES).persistent(true);
 
@@ -1375,7 +1375,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
     @Test
     public void testOnCreateShardWithNoInitialSchemaContext() {
         LOG.info("testOnCreateShardWithNoInitialSchemaContext starting");
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 ActorRef shardManager = actorFactory
                         .createActor(newShardMgrProps(new ConfigurationImpl(new EmptyModuleShardConfigProvider()))
@@ -1407,7 +1407,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
     @Test
     public void testGetSnapshot() throws Exception {
         LOG.info("testGetSnapshot starting");
-        JavaTestKit kit = new JavaTestKit(getSystem());
+        TestKit kit = new TestKit(getSystem());
 
         MockConfiguration mockConfig = new MockConfiguration(ImmutableMap.<String, List<String>>builder()
                 .put("shard1", Arrays.asList("member-1")).put("shard2", Arrays.asList("member-1"))
@@ -1439,7 +1439,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
 
         // Add a new replica
 
-        JavaTestKit mockShardLeaderKit = new JavaTestKit(getSystem());
+        TestKit mockShardLeaderKit = new TestKit(getSystem());
 
         TestShardManager shardManagerInstance = shardManager.underlyingActor();
         shardManagerInstance.setMessageInterceptor(newFindPrimaryInterceptor(mockShardLeaderKit.getRef()));
@@ -1472,7 +1472,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
 
         datastoreContextBuilder.shardInitializationTimeout(3, TimeUnit.SECONDS);
 
-        JavaTestKit kit = new JavaTestKit(getSystem());
+        TestKit kit = new TestKit(getSystem());
 
         MockConfiguration mockConfig = new MockConfiguration(ImmutableMap.<String, List<String>>builder()
                 .put("shard1", Collections.<String>emptyList()).put("shard2", Collections.<String>emptyList())
@@ -1508,7 +1508,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
 
     @Test
     public void testAddShardReplicaForNonExistentShardConfig() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 ActorRef shardManager = actorFactory
                         .createActor(newShardMgrProps(new ConfigurationImpl(new EmptyModuleShardConfigProvider()))
@@ -1559,7 +1559,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
                         .withDispatcher(Dispatchers.DefaultDispatcherId()),
                 shardManagerID);
 
-        new JavaTestKit(system1) {
+        new TestKit(system1) {
             {
                 newReplicaShardManager.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
                 leaderShardManager.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
@@ -1612,7 +1612,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
     @Test
     public void testAddShardReplicaWithPreExistingReplicaInRemoteShardLeader() throws Exception {
         LOG.info("testAddShardReplicaWithPreExistingReplicaInRemoteShardLeader starting");
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 TestActorRef<TestShardManager> shardManager = actorFactory
                         .createTestActor(newPropsShardMgrWithMockShardActor(), shardMgrID);
@@ -1674,7 +1674,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
     @Test
     public void testAddShardReplicaWithPreExistingLocalReplicaLeader() throws Exception {
         LOG.info("testAddShardReplicaWithPreExistingLocalReplicaLeader starting");
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 String memberId = "member-1-shard-default-" + shardMrgIDSuffix;
                 ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
@@ -1702,9 +1702,9 @@ public class ShardManagerTest extends AbstractShardManagerTest {
     @Test
     public void testAddShardReplicaWithAddServerReplyFailure() throws Exception {
         LOG.info("testAddShardReplicaWithAddServerReplyFailure starting");
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
-                JavaTestKit mockShardLeaderKit = new JavaTestKit(getSystem());
+                TestKit mockShardLeaderKit = new TestKit(getSystem());
 
                 MockConfiguration mockConfig = new MockConfiguration(ImmutableMap.<String, List<String>>builder()
                         .put("astronauts", Arrays.asList("member-2")).build());
@@ -1718,7 +1718,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
 
                 shardManager.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
 
-                JavaTestKit terminateWatcher = new JavaTestKit(getSystem());
+                TestKit terminateWatcher = new TestKit(getSystem());
                 terminateWatcher.watch(mockNewReplicaShardActor);
 
                 shardManager.tell(new AddShardReplica("astronauts"), getRef());
@@ -1757,7 +1757,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
     public void testAddShardReplicaWithFindPrimaryTimeout() throws Exception {
         LOG.info("testAddShardReplicaWithFindPrimaryTimeout starting");
         datastoreContextBuilder.shardInitializationTimeout(100, TimeUnit.MILLISECONDS);
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 MockConfiguration mockConfig = new MockConfiguration(ImmutableMap.<String, List<String>>builder()
                         .put("astronauts", Arrays.asList("member-2")).build());
@@ -1781,7 +1781,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
 
     @Test
     public void testRemoveShardReplicaForNonExistentShard() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 ActorRef shardManager = actorFactory
                         .createActor(newShardMgrProps(new ConfigurationImpl(new EmptyModuleShardConfigProvider()))
@@ -1799,7 +1799,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
      * Primary is Local.
      */
     public void testRemoveShardReplicaLocal() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 String memberId = "member-1-shard-default-" + shardMrgIDSuffix;
 
@@ -1879,7 +1879,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
 
         LOG.error("Forwarding actor : {}", actorRef);
 
-        new JavaTestKit(system1) {
+        new TestKit(system1) {
             {
                 newReplicaShardManager.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
                 leaderShardManager.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
@@ -1933,10 +1933,10 @@ public class ShardManagerTest extends AbstractShardManagerTest {
     public void testServerChangeWhenAlreadyInProgress(final String shardName, final Object firstServerChange,
                                                       final Class<?> firstForwardedServerChangeClass,
                                                       final Object secondServerChange) throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
-                JavaTestKit mockShardLeaderKit = new JavaTestKit(getSystem());
-                final JavaTestKit secondRequestKit = new JavaTestKit(getSystem());
+                TestKit mockShardLeaderKit = new TestKit(getSystem());
+                final TestKit secondRequestKit = new TestKit(getSystem());
 
                 MockConfiguration mockConfig = new MockConfiguration(ImmutableMap.<String, List<String>>builder()
                         .put(shardName, Arrays.asList("member-2")).build());
@@ -1966,7 +1966,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
     @Test
     public void testServerRemovedShardActorNotRunning() throws Exception {
         LOG.info("testServerRemovedShardActorNotRunning starting");
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 MockConfiguration mockConfig = new MockConfiguration(ImmutableMap.<String, List<String>>builder()
                         .put("default", Arrays.asList("member-1", "member-2"))
@@ -1999,7 +1999,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
     @Test
     public void testServerRemovedShardActorRunning() throws Exception {
         LOG.info("testServerRemovedShardActorRunning starting");
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 MockConfiguration mockConfig = new MockConfiguration(ImmutableMap.<String, List<String>>builder()
                         .put("default", Arrays.asList("member-1", "member-2"))
@@ -2036,7 +2036,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
     @Test
     public void testShardPersistenceWithRestoredData() throws Exception {
         LOG.info("testShardPersistenceWithRestoredData starting");
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 MockConfiguration mockConfig =
                     new MockConfiguration(ImmutableMap.<String, List<String>>builder()
@@ -2076,7 +2076,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
     @Test
     public void testShutDown() throws Exception {
         LOG.info("testShutDown starting");
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 MockConfiguration mockConfig = new MockConfiguration(ImmutableMap.<String, List<String>>builder()
                         .put("shard1", Arrays.asList("member-1")).put("shard2", Arrays.asList("member-1")).build());
@@ -2120,7 +2120,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
 
     @Test
     public void testChangeServersVotingStatus() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 String memberId = "member-1-shard-default-" + shardMrgIDSuffix;
 
@@ -2156,7 +2156,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
 
     @Test
     public void testChangeServersVotingStatusWithNoLeader() throws Exception {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 String memberId = "member-1-shard-default-" + shardMrgIDSuffix;
 
index 0dc8192..c8ef127 100644 (file)
@@ -26,8 +26,8 @@ import akka.actor.Props;
 import akka.actor.UntypedActor;
 import akka.dispatch.Futures;
 import akka.japi.Creator;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
 import akka.util.Timeout;
 import com.google.common.base.Optional;
 import com.google.common.collect.Maps;
@@ -141,27 +141,24 @@ public class ActorContextTest extends AbstractActorTest {
 
     @Test
     public void testFindLocalShardWithShardFound() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
-                new Within(duration("1 seconds")) {
-                    @Override
-                    protected void run() {
+                within(duration("1 seconds"), () -> {
+                    ActorRef shardActorRef = getSystem().actorOf(Props.create(EchoActor.class));
 
-                        ActorRef shardActorRef = getSystem().actorOf(Props.create(EchoActor.class));
+                    ActorRef shardManagerActorRef = getSystem()
+                            .actorOf(MockShardManager.props(true, shardActorRef));
 
-                        ActorRef shardManagerActorRef = getSystem()
-                                .actorOf(MockShardManager.props(true, shardActorRef));
-
-                        ActorContext actorContext = new ActorContext(getSystem(), shardManagerActorRef,
-                                mock(ClusterWrapper.class), mock(Configuration.class));
+                    ActorContext actorContext = new ActorContext(getSystem(), shardManagerActorRef,
+                        mock(ClusterWrapper.class), mock(Configuration.class));
 
-                        Optional<ActorRef> out = actorContext.findLocalShard("default");
+                    Optional<ActorRef> out = actorContext.findLocalShard("default");
 
-                        assertEquals(shardActorRef, out.get());
+                    assertEquals(shardActorRef, out.get());
 
-                        expectNoMsg();
-                    }
-                };
+                    expectNoMsg();
+                    return null;
+                });
             }
         };
 
@@ -169,7 +166,7 @@ public class ActorContextTest extends AbstractActorTest {
 
     @Test
     public void testFindLocalShardWithShardNotFound() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 ActorRef shardManagerActorRef = getSystem().actorOf(MockShardManager.props(false, null));
 
@@ -185,7 +182,7 @@ public class ActorContextTest extends AbstractActorTest {
 
     @Test
     public void testExecuteRemoteOperation() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 ActorRef shardActorRef = getSystem().actorOf(Props.create(EchoActor.class));
 
@@ -206,7 +203,7 @@ public class ActorContextTest extends AbstractActorTest {
     @Test
     @SuppressWarnings("checkstyle:IllegalCatch")
     public void testExecuteRemoteOperationAsync() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 ActorRef shardActorRef = getSystem().actorOf(Props.create(EchoActor.class));
 
@@ -316,7 +313,7 @@ public class ActorContextTest extends AbstractActorTest {
 
     @Test
     public void testSetDatastoreContext() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 ActorContext actorContext = new ActorContext(getSystem(), getRef(),
                         mock(ClusterWrapper.class), mock(Configuration.class), DatastoreContext.newBuilder()
@@ -474,7 +471,7 @@ public class ActorContextTest extends AbstractActorTest {
 
     @Test
     public void testBroadcast() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 ActorRef shardActorRef1 = getSystem().actorOf(MessageCollectorActor.props());
                 ActorRef shardActorRef2 = getSystem().actorOf(MessageCollectorActor.props());
index b0d01d5..d977f93 100644 (file)
@@ -21,7 +21,7 @@ import akka.actor.ActorSystem;
 import akka.actor.Address;
 import akka.actor.AddressFromURIString;
 import akka.cluster.Cluster;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.collect.Lists;
 import com.typesafe.config.ConfigFactory;
 import java.util.Collections;
@@ -128,8 +128,8 @@ public class DistributedShardedDOMDataTreeRemotingTest extends AbstractTest {
             followerOperDatastore.close();
         }
 
-        JavaTestKit.shutdownActorSystem(leaderSystem, null, Boolean.TRUE);
-        JavaTestKit.shutdownActorSystem(followerSystem, null, Boolean.TRUE);
+        TestKit.shutdownActorSystem(leaderSystem, Boolean.TRUE);
+        TestKit.shutdownActorSystem(followerSystem, Boolean.TRUE);
 
         InMemoryJournal.clear();
         InMemorySnapshotStore.clear();
@@ -139,7 +139,7 @@ public class DistributedShardedDOMDataTreeRemotingTest extends AbstractTest {
         initEmptyDatastores(MODULE_SHARDS_CONFIG);
     }
 
-    private void initEmptyDatastores(String moduleShardsConfig) throws Exception {
+    private void initEmptyDatastores(final String moduleShardsConfig) throws Exception {
         leaderTestKit = new IntegrationTestKit(leaderSystem, leaderDatastoreContextBuilder);
 
         leaderConfigDatastore = leaderTestKit.setupDistributedDataStore(
index 3e224a9..6546538 100644 (file)
@@ -28,7 +28,7 @@ import akka.actor.Address;
 import akka.actor.AddressFromURIString;
 import akka.actor.Props;
 import akka.cluster.Cluster;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.base.Optional;
 import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.CheckedFuture;
@@ -158,7 +158,7 @@ public class DistributedShardedDOMDataTreeTest extends AbstractTest {
             operDistributedDatastore.close();
         }
 
-        JavaTestKit.shutdownActorSystem(leaderSystem);
+        TestKit.shutdownActorSystem(leaderSystem);
 
         InMemoryJournal.clear();
         InMemorySnapshotStore.clear();
index 978cc27..ad8a69f 100644 (file)
@@ -18,7 +18,7 @@ import static org.mockito.Mockito.verify;
 
 import akka.actor.ActorRef;
 import akka.actor.Props;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import org.junit.Test;
 import org.opendaylight.controller.cluster.datastore.AbstractActorTest;
 import org.opendaylight.controller.cluster.dom.api.LeaderLocation;
@@ -30,7 +30,7 @@ public class RoleChangeListenerActorTest extends AbstractActorTest {
 
     @Test
     public void testRegisterRoleChangeListenerOnStart() {
-        new JavaTestKit(getSystem()) {
+        new TestKit(getSystem()) {
             {
                 final LeaderLocationListener listener = mock(LeaderLocationListener.class);
                 final Props props = RoleChangeListenerActor.props(getRef(), listener);
index 6557934..8b3b935 100644 (file)
@@ -15,7 +15,7 @@ import static org.junit.Assert.assertTrue;
 
 import akka.actor.ActorRef;
 import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import java.net.URI;
 import java.util.Collection;
 import org.junit.AfterClass;
@@ -68,9 +68,9 @@ public class AbstractRpcTest {
     static RemoteRpcProviderConfig config2;
 
     protected ActorRef rpcInvoker1;
-    protected JavaTestKit rpcRegistry1Probe;
+    protected TestKit rpcRegistry1Probe;
     protected ActorRef rpcInvoker2;
-    protected JavaTestKit rpcRegistry2Probe;
+    protected TestKit rpcRegistry2Probe;
     protected SchemaContext schemaContext;
     protected RemoteRpcImplementation remoteRpcImpl1;
     protected RemoteRpcImplementation remoteRpcImpl2;
@@ -90,8 +90,8 @@ public class AbstractRpcTest {
 
     @AfterClass
     public static void teardown() {
-        JavaTestKit.shutdownActorSystem(node1);
-        JavaTestKit.shutdownActorSystem(node2);
+        TestKit.shutdownActorSystem(node1);
+        TestKit.shutdownActorSystem(node2);
         node1 = null;
         node2 = null;
     }
@@ -102,9 +102,9 @@ public class AbstractRpcTest {
 
         MockitoAnnotations.initMocks(this);
 
-        rpcRegistry1Probe = new JavaTestKit(node1);
+        rpcRegistry1Probe = new TestKit(node1);
         rpcInvoker1 = node1.actorOf(RpcInvoker.props(domRpcService1));
-        rpcRegistry2Probe = new JavaTestKit(node2);
+        rpcRegistry2Probe = new TestKit(node2);
         rpcInvoker2 = node2.actorOf(RpcInvoker.props(domRpcService2));
         remoteRpcImpl1 = new RemoteRpcImplementation(rpcInvoker2, config1);
         remoteRpcImpl2 = new RemoteRpcImplementation(rpcInvoker1, config2);
index a5158bc..81916c4 100644 (file)
@@ -12,7 +12,7 @@ import static org.mockito.Mockito.mock;
 
 import akka.actor.ActorRef;
 import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import com.typesafe.config.Config;
 import com.typesafe.config.ConfigFactory;
 import java.util.concurrent.TimeUnit;
@@ -40,7 +40,7 @@ public class RemoteRpcProviderTest {
 
     @AfterClass
     public static void teardown() {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
         system = null;
     }
 
index 02d4631..d588736 100644 (file)
@@ -13,7 +13,7 @@ import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.when;
 
 import akka.actor.Status.Failure;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.util.concurrent.Futures;
 import org.junit.Assert;
 import org.junit.Test;
@@ -31,7 +31,7 @@ public class RpcBrokerTest extends AbstractRpcTest {
 
     @Test
     public void testExecuteRpc() {
-        new JavaTestKit(node1) {
+        new TestKit(node1) {
             {
 
                 final ContainerNode invokeRpcResult = makeRPCOutput("bar");
@@ -52,7 +52,7 @@ public class RpcBrokerTest extends AbstractRpcTest {
 
     @Test
     public void testExecuteRpcFailureWithException() {
-        new JavaTestKit(node1) {
+        new TestKit(node1) {
             {
                 when(domRpcService1.invokeRpc(eq(TEST_RPC_TYPE), Mockito.<NormalizedNode<?, ?>>any()))
                         .thenReturn(Futures.<DOMRpcResult, DOMRpcException>immediateFailedCheckedFuture(
index fa64bbd..680d55d 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.controller.remote.rpc;
 
 import akka.actor.ActorRef;
 import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import com.typesafe.config.ConfigFactory;
 import java.net.URISyntaxException;
 import java.util.Collections;
@@ -40,16 +40,16 @@ public class RpcListenerTest {
 
     @AfterClass
     public static void teardown() {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
         system = null;
     }
 
     @Test
     public void testRouteAdd() throws URISyntaxException, InterruptedException {
-        new JavaTestKit(system) {
+        new TestKit(system) {
             {
                 // Test announcements
-                final JavaTestKit probeReg = new JavaTestKit(system);
+                final TestKit probeReg = new TestKit(system);
                 final ActorRef rpcRegistry = probeReg.getRef();
 
                 final RpcListener rpcListener = new RpcListener(rpcRegistry);
@@ -61,10 +61,10 @@ public class RpcListenerTest {
 
     @Test
     public void testRouteRemove() throws URISyntaxException, InterruptedException {
-        new JavaTestKit(system) {
+        new TestKit(system) {
             {
                 // Test announcements
-                final JavaTestKit probeReg = new JavaTestKit(system);
+                final TestKit probeReg = new TestKit(system);
                 final ActorRef rpcRegistry = probeReg.getRef();
 
                 final RpcListener rpcListener = new RpcListener(rpcRegistry);
index aecadc4..dd11dd7 100644 (file)
@@ -11,8 +11,8 @@ import akka.actor.ActorRef;
 import akka.actor.ActorSystem;
 import akka.actor.Address;
 import akka.actor.Props;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.collect.ImmutableMap;
 import java.util.Collections;
 import java.util.Map;
@@ -52,7 +52,7 @@ public class RpcRegistrarTest {
         MockitoAnnotations.initMocks(this);
         system = ActorSystem.create("test");
 
-        final JavaTestKit testKit = new JavaTestKit(system);
+        final TestKit testKit = new TestKit(system);
         final RemoteRpcProviderConfig config = new RemoteRpcProviderConfig.Builder("system").build();
         final Props props = RpcRegistrar.props(config, service);
         testActorRef = new TestActorRef<>(system, props, testKit.getRef(), "actorRef");
@@ -63,7 +63,7 @@ public class RpcRegistrarTest {
         final DOMRpcIdentifier secondEndpointId = DOMRpcIdentifier.create(
                 SchemaPath.create(true, QName.create("second:identifier", "bar")));
 
-        final JavaTestKit senderKit = new JavaTestKit(system);
+        final TestKit senderKit = new TestKit(system);
         firstEndpoint = new RemoteRpcEndpoint(senderKit.getRef(), Collections.singletonList(firstEndpointId));
         secondEndpoint = new RemoteRpcEndpoint(senderKit.getRef(), Collections.singletonList(secondEndpointId));
 
@@ -78,7 +78,7 @@ public class RpcRegistrarTest {
 
     @After
     public void tearDown() throws Exception {
-        JavaTestKit.shutdownActorSystem(system, null, Boolean.TRUE);
+        TestKit.shutdownActorSystem(system, true);
     }
 
     @Test
@@ -136,4 +136,4 @@ public class RpcRegistrarTest {
 
         Mockito.verifyNoMoreInteractions(service, oldReg, newReg);
     }
-}
\ No newline at end of file
+}
index 807480b..d9c686c 100644 (file)
@@ -20,7 +20,7 @@ import akka.cluster.ClusterEvent.CurrentClusterState;
 import akka.cluster.Member;
 import akka.cluster.MemberStatus;
 import akka.cluster.UniqueAddress;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.base.Stopwatch;
 import com.google.common.collect.Sets;
 import com.google.common.util.concurrent.Uninterruptibles;
@@ -63,12 +63,12 @@ public class RpcRegistryTest {
     private static ActorSystem node2;
     private static ActorSystem node3;
 
-    private JavaTestKit invoker1;
-    private JavaTestKit invoker2;
-    private JavaTestKit invoker3;
-    private JavaTestKit registrar1;
-    private JavaTestKit registrar2;
-    private JavaTestKit registrar3;
+    private TestKit invoker1;
+    private TestKit invoker2;
+    private TestKit invoker3;
+    private TestKit registrar1;
+    private TestKit registrar2;
+    private TestKit registrar3;
     private ActorRef registry1;
     private ActorRef registry2;
     private ActorRef registry3;
@@ -113,21 +113,21 @@ public class RpcRegistryTest {
 
     @AfterClass
     public static void staticTeardown() {
-        JavaTestKit.shutdownActorSystem(node1);
-        JavaTestKit.shutdownActorSystem(node2);
-        JavaTestKit.shutdownActorSystem(node3);
+        TestKit.shutdownActorSystem(node1);
+        TestKit.shutdownActorSystem(node2);
+        TestKit.shutdownActorSystem(node3);
     }
 
     @Before
     public void setup() {
-        invoker1 = new JavaTestKit(node1);
-        registrar1 = new JavaTestKit(node1);
+        invoker1 = new TestKit(node1);
+        registrar1 = new TestKit(node1);
         registry1 = node1.actorOf(RpcRegistry.props(config(node1), invoker1.getRef(), registrar1.getRef()));
-        invoker2 = new JavaTestKit(node2);
-        registrar2 = new JavaTestKit(node2);
+        invoker2 = new TestKit(node2);
+        registrar2 = new TestKit(node2);
         registry2 = node2.actorOf(RpcRegistry.props(config(node2), invoker2.getRef(), registrar2.getRef()));
-        invoker3 = new JavaTestKit(node3);
-        registrar3 = new JavaTestKit(node3);
+        invoker3 = new TestKit(node3);
+        registrar3 = new TestKit(node3);
         registry3 = node3.actorOf(RpcRegistry.props(config(node3), invoker3.getRef(), registrar3.getRef()));
     }
 
@@ -185,7 +185,7 @@ public class RpcRegistryTest {
         registry1.tell(new AddOrUpdateRoutes(addedRouteIds), ActorRef.noSender());
 
         // Bucket store should get an update bucket message. Updated bucket contains added rpc.
-        final JavaTestKit testKit = new JavaTestKit(node1);
+        final TestKit testKit = new TestKit(node1);
 
         Map<Address, Bucket<RoutingTable>> buckets = retrieveBuckets(registry1, testKit, nodeAddress);
         verifyBucket(buckets.get(nodeAddress), addedRouteIds);
@@ -222,7 +222,7 @@ public class RpcRegistryTest {
         registry1.tell(new AddOrUpdateRoutes(addedRouteIds), ActorRef.noSender());
 
         // Bucket store on node2 should get a message to update its local copy of remote buckets
-        final JavaTestKit testKit = new JavaTestKit(node2);
+        final TestKit testKit = new TestKit(node2);
 
         Map<Address, Bucket<RoutingTable>> buckets = retrieveBuckets(registry2, testKit, node1Address);
         verifyBucket(buckets.get(node1Address), addedRouteIds);
@@ -238,7 +238,7 @@ public class RpcRegistryTest {
         LOG.info("testRpcAddRemoveInCluster ending");
     }
 
-    private void verifyEmptyBucket(final JavaTestKit testKit, final ActorRef registry, final Address address)
+    private void verifyEmptyBucket(final TestKit testKit, final ActorRef registry, final Address address)
             throws AssertionError {
         Map<Address, Bucket<RoutingTable>> buckets;
         int numTries = 0;
@@ -263,7 +263,7 @@ public class RpcRegistryTest {
      */
     @Test
     public void testRpcAddedOnMultiNodes() throws Exception {
-        final JavaTestKit testKit = new JavaTestKit(node3);
+        final TestKit testKit = new TestKit(node3);
 
         // Add rpc on node 1
         List<DOMRpcIdentifier> addedRouteIds1 = createRouteIds();
@@ -298,8 +298,7 @@ public class RpcRegistryTest {
 
     }
 
-    private static void assertEndpoints(final UpdateRemoteEndpoints msg, final Address address,
-            final JavaTestKit invoker) {
+    private static void assertEndpoints(final UpdateRemoteEndpoints msg, final Address address, final TestKit invoker) {
         final Map<Address, Optional<RemoteRpcEndpoint>> endpoints = msg.getEndpoints();
         Assert.assertEquals(1, endpoints.size());
 
@@ -316,7 +315,7 @@ public class RpcRegistryTest {
         Assert.assertEquals("hello", s);
     }
 
-    private static Map<Address, Long> retrieveVersions(final ActorRef bucketStore, final JavaTestKit testKit) {
+    private static Map<Address, Long> retrieveVersions(final ActorRef bucketStore, final TestKit testKit) {
         bucketStore.tell(GET_BUCKET_VERSIONS, testKit.getRef());
         @SuppressWarnings("unchecked")
         final Map<Address, Long> reply = testKit.expectMsgClass(Duration.create(3, TimeUnit.SECONDS), Map.class);
@@ -336,7 +335,7 @@ public class RpcRegistryTest {
     }
 
     private static Map<Address, Bucket<RoutingTable>> retrieveBuckets(final ActorRef bucketStore,
-            final JavaTestKit testKit, final Address... addresses) {
+            final TestKit testKit, final Address... addresses) {
         int numTries = 0;
         while (true) {
             bucketStore.tell(GET_ALL_BUCKETS, testKit.getRef());
@@ -368,7 +367,7 @@ public class RpcRegistryTest {
 
     @Test
     public void testAddRoutesConcurrency() {
-        final JavaTestKit testKit = new JavaTestKit(node1);
+        final TestKit testKit = new TestKit(node1);
 
         final int nRoutes = 500;
         final Collection<DOMRpcIdentifier> added = new ArrayList<>(nRoutes);
index 4898b27..b9784ab 100644 (file)
@@ -11,8 +11,8 @@ import akka.actor.ActorRef;
 import akka.actor.ActorSystem;
 import akka.actor.Address;
 import akka.actor.Props;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.collect.ImmutableMap;
 import com.typesafe.config.ConfigFactory;
 import java.util.HashMap;
@@ -50,7 +50,7 @@ public class BucketStoreTest {
 
     @AfterClass
     public static void teardown() {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
     }
 
     /**
index f1e7fea..b199ace 100644 (file)
@@ -20,8 +20,8 @@ import akka.actor.ActorSelection;
 import akka.actor.ActorSystem;
 import akka.actor.Address;
 import akka.actor.Props;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
 import com.typesafe.config.ConfigFactory;
 import java.util.Map;
 import org.junit.After;
@@ -50,7 +50,7 @@ public class GossiperTest {
 
     @AfterClass
     public static void teardown() {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
     }
 
     @Before
index b48d40b..8b23154 100644 (file)
@@ -10,8 +10,8 @@ package org.opendaylight.controller.remote.rpc.registry.mbeans;
 import akka.actor.ActorRef;
 import akka.actor.ActorSystem;
 import akka.actor.Props;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.Uninterruptibles;
 import java.util.Collections;
@@ -53,9 +53,9 @@ public class RemoteRpcRegistryMXBeanImplTest {
         buckets = Lists.newArrayList(emptyRpcIdentifier, localRpcIdentifier);
 
         final RemoteRpcProviderConfig config = new RemoteRpcProviderConfig.Builder("system").build();
-        final JavaTestKit invoker = new JavaTestKit(system);
-        final JavaTestKit registrar = new JavaTestKit(system);
-        final JavaTestKit supervisor = new JavaTestKit(system);
+        final TestKit invoker = new TestKit(system);
+        final TestKit registrar = new TestKit(system);
+        final TestKit supervisor = new TestKit(system);
         final Props props = RpcRegistry.props(config, invoker.getRef(), registrar.getRef());
         testActor = new TestActorRef<>(system, props, supervisor.getRef(), "testActor");
         final RpcRegistry rpcRegistry = testActor.underlyingActor();
@@ -66,7 +66,7 @@ public class RemoteRpcRegistryMXBeanImplTest {
 
     @After
     public void tearDown() throws Exception {
-        JavaTestKit.shutdownActorSystem(system, null, Boolean.TRUE);
+        TestKit.shutdownActorSystem(system, Boolean.TRUE);
     }
 
     @Test
@@ -159,4 +159,4 @@ public class RemoteRpcRegistryMXBeanImplTest {
 
         Assert.assertTrue(bucketVersions.contains(testActor.provider().getDefaultAddress().toString()));
     }
-}
\ No newline at end of file
+}
index 0b94b54..a0f2b0b 100644 (file)
@@ -13,8 +13,8 @@ import static org.junit.Assert.assertTrue;
 import akka.actor.ActorRef;
 import akka.actor.ActorSystem;
 import akka.japi.Pair;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
 import com.typesafe.config.ConfigFactory;
 import java.util.ArrayList;
 import java.util.List;
@@ -32,7 +32,7 @@ public class LatestEntryRoutingLogicTest {
 
     @AfterClass
     public static void teardown() {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
         system = null;
     }
 

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.