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:
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestProbe;
import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
import com.google.common.collect.Iterables;
import java.util.Optional;
import java.util.function.Consumer;
import com.google.common.collect.Iterables;
import java.util.Optional;
import java.util.function.Consumer;
@After
public void tearDown() throws Exception {
@After
public void tearDown() throws Exception {
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);
}
protected Request<?, ?> createRequest(final ActorRef replyTo) {
}
protected Request<?, ?> createRequest(final ActorRef replyTo) {
import static org.opendaylight.controller.cluster.access.client.ConnectionEntryMatcher.entryWithRequest;
import akka.actor.ActorSystem;
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.TestProbe;
+import akka.testkit.javadsl.TestKit;
import com.google.common.base.Ticker;
import java.util.Collection;
import java.util.Optional;
import com.google.common.base.Ticker;
import java.util.Collection;
import java.util.Optional;
@After
public void tearDown() throws Exception {
@After
public void tearDown() throws Exception {
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);
import akka.persistence.Persistence;
import akka.persistence.SelectedSnapshot;
import akka.persistence.SnapshotMetadata;
import akka.persistence.Persistence;
import akka.persistence.SelectedSnapshot;
import akka.persistence.SnapshotMetadata;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestProbe;
import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
import java.lang.reflect.Field;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.lang.reflect.Field;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
@After
public void tearDown() throws Exception {
@After
public void tearDown() throws Exception {
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);
import static org.junit.Assert.assertSame;
import akka.actor.ActorSystem;
import static org.junit.Assert.assertSame;
import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestProbe;
import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
import com.google.common.base.Ticker;
import java.util.concurrent.TimeUnit;
import org.junit.After;
import com.google.common.base.Ticker;
import java.util.concurrent.TimeUnit;
import org.junit.After;
@After
public void tearDown() throws Exception {
@After
public void tearDown() throws Exception {
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);
package org.opendaylight.controller.cluster.raft;
import akka.actor.ActorSystem;
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;
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
@AfterClass
public static void tearDownClass() throws Exception {
deleteJournal();
@AfterClass
public static void tearDownClass() throws Exception {
deleteJournal();
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);
import akka.actor.Terminated;
import akka.dispatch.Dispatchers;
import akka.dispatch.Mailboxes;
import akka.actor.Terminated;
import akka.dispatch.Dispatchers;
import akka.dispatch.Mailboxes;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestActorRef;
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;
import akka.util.Timeout;
import com.google.common.base.Stopwatch;
import com.google.common.collect.ImmutableMap;
}
protected void killActor(final TestActorRef<TestRaftActor> actor) {
}
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.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);
}
testkit.unwatch(actor);
}
import akka.actor.ActorRef;
import akka.actor.Status;
import akka.pattern.Patterns;
import akka.actor.ActorRef;
import akka.actor.Status;
import akka.pattern.Patterns;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestActorRef;
import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
import com.google.common.collect.ImmutableMap;
import java.util.Arrays;
import java.util.Collections;
import com.google.common.collect.ImmutableMap;
import java.util.Arrays;
import java.util.Collections;
createRaftActors();
createRequestLeadershipResultCollectorActor();
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();
sendFollower2RequestLeadershipTransferToLeader();
import akka.actor.Props;
import akka.actor.UntypedActor;
import akka.dispatch.Dispatchers;
import akka.actor.Props;
import akka.actor.UntypedActor;
import akka.dispatch.Dispatchers;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestActorRef;
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;
import com.google.common.base.Optional;
import com.google.common.base.Stopwatch;
import com.google.common.collect.ImmutableMap;
private ActorRef newFollowerCollectorActor;
private RaftActorContext newFollowerActorContext;
private ActorRef newFollowerCollectorActor;
private RaftActorContext newFollowerActorContext;
- private final JavaTestKit testKit = new JavaTestKit(getSystem());
+ private final TestKit testKit = new TestKit(getSystem());
@Before
public void setup() {
@Before
public void setup() {
List<Object> snapshotState = MockRaftActor.fromState(applySnapshot.getSnapshot().getState());
assertEquals("Snapshot state", snapshotState, leaderRaftActor.getState());
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());
assertEquals("getStatus", ServerChangeStatus.OK, addServerReply.getStatus());
assertEquals("getLeaderHint", LEADER_ID, addServerReply.getLeaderHint().get());
List<Object> snapshotState = MockRaftActor.fromState(applySnapshot.getSnapshot().getState());
assertEquals("Snapshot state", snapshotState, leaderRaftActor.getState());
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());
assertEquals("getStatus", ServerChangeStatus.OK, addServerReply.getStatus());
assertEquals("getLeaderHint", LEADER_ID, addServerReply.getLeaderHint().get());
leaderActor.tell(new AddServer(NEW_SERVER_ID, newFollowerRaftActor.path().toString(), false), testKit.getRef());
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());
assertEquals("getStatus", ServerChangeStatus.OK, addServerReply.getStatus());
assertEquals("getLeaderHint", LEADER_ID, addServerReply.getLeaderHint().get());
leaderActor.tell(new AddServer(NEW_SERVER_ID2, followerActor.path().toString(), false), testKit.getRef());
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());
assertEquals("getStatus", ServerChangeStatus.OK, addServerReply.getStatus());
assertEquals("getLeaderHint", java.util.Optional.of(LEADER_ID), addServerReply.getLeaderHint());
InstallSnapshot installSnapshot = expectFirstMatching(newFollowerCollectorActor, InstallSnapshot.class);
// Send a second AddServer - should get queued
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
leaderActor.tell(new AddServer(NEW_SERVER_ID2, followerActor.path().toString(), false), testKit2.getRef());
// Continue the first AddServer
newFollowerRaftActor.tell(installSnapshot, leaderActor);
// Verify both complete successfully
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());
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
assertEquals("getStatus", ServerChangeStatus.OK, addServerReply.getStatus());
// Verify ServerConfigurationPayload entries in leader's log
leaderRaftActor.setDropMessageOfType(null);
leaderActor.tell(commitMsg, leaderActor);
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());
assertEquals("getStatus", ServerChangeStatus.OK, addServerReply.getStatus());
assertEquals("getLeaderHint", LEADER_ID, addServerReply.getLeaderHint().get());
leaderActor.tell(new AddServer(NEW_SERVER_ID, newFollowerRaftActor.path().toString(), true), testKit.getRef());
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());
assertEquals("getStatus", ServerChangeStatus.TIMEOUT, addServerReply.getStatus());
assertEquals("Leader peers size", 0, leaderActorContext.getPeerIds().size());
leaderActor.tell(new RaftActorServerConfigurationSupport.ServerOperationTimeout(NEW_SERVER_ID), leaderActor);
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());
assertEquals("getStatus", ServerChangeStatus.NO_LEADER, addServerReply.getStatus());
assertEquals("Leader peers size", 0, leaderActorContext.getPeerIds().size());
leaderRaftActor.setDropMessageOfType(null);
leaderActor.tell(snapshotReply, leaderActor);
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());
assertEquals("getStatus", ServerChangeStatus.NO_LEADER, addServerReply.getStatus());
assertEquals("Leader peers size", 0, leaderActorContext.getPeerIds().size());
leaderActor.tell(new UnInitializedFollowerSnapshotReply("bogus"), leaderActor);
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());
assertEquals("getStatus", ServerChangeStatus.TIMEOUT, addServerReply.getStatus());
assertEquals("Leader peers size", 0, leaderActorContext.getPeerIds().size());
noLeaderActor.tell(new AddServer(NEW_SERVER_ID, newFollowerRaftActor.path().toString(), true),
testKit.getRef());
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");
assertEquals("getStatus", ServerChangeStatus.NO_LEADER, addServerReply.getStatus());
LOG.info("testAddServerWithNoLeader ending");
leaderActor.tell(new AddServer(NEW_SERVER_ID2, "", false), testKit.getRef());
// The first AddServer should succeed with OK even though consensus wasn't reached
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());
assertEquals("getStatus", ServerChangeStatus.OK, addServerReply.getStatus());
assertEquals("getLeaderHint", LEADER_ID, addServerReply.getLeaderHint().get());
votingServer(NEW_SERVER_ID));
// The second AddServer should fail since consensus wasn't reached for the first
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());
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");
assertEquals("getStatus", ServerChangeStatus.PRIOR_REQUEST_CONSENSUS_TIMEOUT, addServerReply.getStatus());
LOG.info("testAddServerWithNoConsensusReached ending");
leaderActor.tell(new AddServer(FOLLOWER_ID, followerActor.path().toString(), true), testKit.getRef());
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");
assertEquals("getStatus", ServerChangeStatus.ALREADY_EXISTS, addServerReply.getStatus());
LOG.info("testAddServerWithExistingServer ending");
leaderActor.underlyingActor().waitForInitializeBehaviorComplete();
leaderActor.tell(new RemoveServer(FOLLOWER_ID), testKit.getRef());
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());
RemoveServerReply.class);
assertEquals("getStatus", ServerChangeStatus.NO_LEADER, removeServerReply.getStatus());
actorFactory.generateActorId(LEADER_ID));
leaderActor.tell(new RemoveServer(NEW_SERVER_ID), testKit.getRef());
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());
RemoveServerReply.class);
assertEquals("getStatus", ServerChangeStatus.DOES_NOT_EXIST, removeServerReply.getStatus());
follower2Actor.underlyingActor().waitForInitializeBehaviorComplete();
leaderActor.tell(new RemoveServer(FOLLOWER_ID), testKit.getRef());
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());
RemoveServerReply.class);
assertEquals("getStatus", ServerChangeStatus.OK, removeServerReply.getStatus());
followerActorId);
leaderActor.tell(new RemoveServer(LEADER_ID), testKit.getRef());
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());
RemoveServerReply.class);
assertEquals("getStatus", ServerChangeStatus.OK, removeServerReply.getStatus());
actorFactory.generateActorId(LEADER_ID));
leaderActor.tell(new RemoveServer(LEADER_ID), testKit.getRef());
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());
RemoveServerReply.class);
assertEquals("getStatus", ServerChangeStatus.NOT_SUPPORTED, removeServerReply.getStatus());
leaderActor.tell(new ChangeServersVotingStatus(ImmutableMap.of(FOLLOWER_ID, false, FOLLOWER_ID2, false)),
testKit.getRef());
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);
assertEquals("getStatus", ServerChangeStatus.OK, reply.getStatus());
final ApplyState applyState = MessageCollectorActor.expectFirstMatching(leaderCollector, ApplyState.class);
// Send second ChangeServersVotingStatus message
leaderActor.tell(new ChangeServersVotingStatus(ImmutableMap.of(FOLLOWER_ID, true)), testKit.getRef());
// 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);
assertEquals("getStatus", ServerChangeStatus.OK, reply.getStatus());
MessageCollectorActor.expectFirstMatching(leaderCollector, ApplyState.class);
// Send ChangeServersVotingStatus message
leaderActor.tell(new ChangeServersVotingStatus(ImmutableMap.of(LEADER_ID, false)), testKit.getRef());
// 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);
assertEquals("getStatus", ServerChangeStatus.OK, reply.getStatus());
MessageCollectorActor.expectFirstMatching(leaderCollector, ApplyState.class);
.withDispatcher(Dispatchers.DefaultDispatcherId()), actorFactory.generateActorId(LEADER_ID));
leaderActor.tell(new ChangeServersVotingStatus(ImmutableMap.of(LEADER_ID, false)), testKit.getRef());
.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");
assertEquals("getStatus", ServerChangeStatus.INVALID_REQUEST, reply.getStatus());
LOG.info("testChangeLeaderToNonVotingInSingleNode ending");
ChangeServersVotingStatus changeServers = new ChangeServersVotingStatus(ImmutableMap.of(node1ID, true,
node2ID, true, "downNode1", false, "downNode2", false));
node1RaftActorRef.tell(changeServers, testKit.getRef());
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());
assertEquals("getStatus", ServerChangeStatus.NO_LEADER, reply.getStatus());
assertEquals("getRaftState", RaftState.Follower, node1RaftActor.getRaftState());
node1RaftActor.setPeerAddress(node2ID, node2RaftActorRef.path().toString());
node1RaftActorRef.tell(changeServers, testKit.getRef());
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,
assertEquals("getStatus", ServerChangeStatus.OK, reply.getStatus());
ApplyJournalEntries apply = MessageCollectorActor.expectFirstMatching(node1Collector,
ChangeServersVotingStatus changeServers = new ChangeServersVotingStatus(ImmutableMap.of(node1ID, true));
node1RaftActorRef.tell(changeServers, testKit.getRef());
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)),
assertEquals("getStatus", ServerChangeStatus.NO_LEADER, reply.getStatus());
assertEquals("Server config", Sets.newHashSet(nonVotingServer(node1ID), votingServer(node2ID)),
ChangeServersVotingStatus changeServers = new ChangeServersVotingStatus(
ImmutableMap.of(node1ID, true, node2ID, true));
node1RaftActorRef.tell(changeServers, testKit.getRef());
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);
assertEquals("getStatus", ServerChangeStatus.OK, reply.getStatus());
MessageCollectorActor.expectFirstMatching(node2Collector, ApplyJournalEntries.class);
node2RaftActorRef.tell(TimeoutNow.INSTANCE, ActorRef.noSender());
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);
assertEquals("getStatus", ServerChangeStatus.OK, reply.getStatus());
MessageCollectorActor.expectFirstMatching(node1Collector, ApplyJournalEntries.class);
import akka.persistence.SaveSnapshotSuccess;
import akka.persistence.SnapshotMetadata;
import akka.persistence.SnapshotOffer;
import akka.persistence.SaveSnapshotSuccess;
import akka.persistence.SnapshotMetadata;
import akka.persistence.SnapshotOffer;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestActorRef;
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;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap;
import com.google.common.util.concurrent.Uninterruptibles;
public void testRaftActorRecoveryWithPersistenceEnabled() throws Exception {
TEST_LOG.info("testRaftActorRecoveryWithPersistenceEnabled starting");
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();
String persistenceId = factory.generateActorId("follower-");
DefaultConfigParamsImpl config = new DefaultConfigParamsImpl();
// kill the actor
followerActor.tell(PoisonPill.getInstance(), null);
// 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);
kit.unwatch(followerActor);
@Test
public void testUpdateElectionTermPersistedWithPersistenceDisabled() throws Exception {
@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));
String persistenceId = factory.generateActorId("follower-");
DefaultConfigParamsImpl config = new DefaultConfigParamsImpl();
config.setHeartBeatInterval(new FiniteDuration(100, TimeUnit.MILLISECONDS));
public void testGetSnapshot() throws Exception {
TEST_LOG.info("testGetSnapshot starting");
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();
String persistenceId = factory.generateActorId("test-actor-");
DefaultConfigParamsImpl config = new DefaultConfigParamsImpl();
package org.opendaylight.controller.cluster.raft;
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;
import akka.actor.Actor;
import akka.actor.ActorIdentity;
import akka.actor.ActorRef;
import akka.actor.PoisonPill;
import akka.actor.Props;
import akka.pattern.Patterns;
import akka.actor.PoisonPill;
import akka.actor.Props;
import akka.pattern.Patterns;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestActorRef;
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;
import akka.util.Timeout;
import com.google.common.base.Stopwatch;
import com.google.common.util.concurrent.Uninterruptibles;
return prefix + actorCount++;
}
return prefix + actorCount++;
}
- public void killActor(ActorRef actor, JavaTestKit kit) {
+ public void killActor(ActorRef actor, TestKit kit) {
killActor(actor, kit, true);
}
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());
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);
if (remove) {
createdActors.remove(actor);
@Override
public void close() {
@Override
public void close() {
- JavaTestKit kit = new JavaTestKit(system);
+ TestKit kit = new TestKit(system);
for (ActorRef actor : createdActors) {
killActor(actor, kit, false);
}
for (ActorRef actor : createdActors) {
killActor(actor, kit, false);
}
import akka.dispatch.Dispatchers;
import akka.dispatch.Mailboxes;
import akka.pattern.Patterns;
import akka.dispatch.Dispatchers;
import akka.dispatch.Mailboxes;
import akka.pattern.Patterns;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestActorRef;
import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
import akka.util.Timeout;
import com.google.common.util.concurrent.Uninterruptibles;
import java.util.Map;
import akka.util.Timeout;
import com.google.common.util.concurrent.Uninterruptibles;
import java.util.Map;
@After
public void tearDown() throws Exception {
@After
public void tearDown() throws Exception {
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);
}
DefaultConfigParamsImpl newConfigParams() {
}
DefaultConfigParamsImpl newConfigParams() {
import akka.actor.ActorRef;
import akka.dispatch.Dispatchers;
import akka.actor.ActorRef;
import akka.dispatch.Dispatchers;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestActorRef;
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;
import com.google.common.base.Optional;
import com.google.common.base.Stopwatch;
import com.google.common.collect.ImmutableList;
// Reinstate the actor from persistence
// 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);
followerActorRef = actorFactory.createTestActor(builder.props()
.withDispatcher(Dispatchers.DefaultDispatcherId()), id);
import akka.actor.PoisonPill;
import akka.actor.Props;
import akka.actor.Terminated;
import akka.actor.PoisonPill;
import akka.actor.Props;
import akka.actor.Terminated;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestActorRef;
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;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap;
import com.google.common.io.ByteSource;
assertTrue("Behavior not instance of Leader when all followers are active", newBehavior instanceof Leader);
// kill 1 follower and verify if that got killed
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);
probe.watch(followerActor1);
followerActor1.tell(PoisonPill.getInstance(), ActorRef.noSender());
final Terminated termMsg1 = probe.expectMsgClass(Terminated.class);
import akka.actor.DeadLetter;
import akka.actor.Props;
import akka.actor.UntypedActor;
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;
import com.typesafe.config.ConfigFactory;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;
@Test
public void shouldSendMsgToDeadLetterWhenQueueIsFull() throws InterruptedException {
@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);
final FiniteDuration twentySeconds = new FiniteDuration(20, TimeUnit.SECONDS);
//2nd to 11th messages are put on the queue
//12th message is sent to dead letter.
for (int i = 0; i < 12; i++) {
//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);
}
mockReceiver.expectMsgClass(twentySeconds, DeadLetter.class);
import akka.remote.AssociationErrorEvent;
import akka.remote.InvalidAssociation;
import akka.remote.ThisActorSystemQuarantinedEvent;
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;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@After
public void tearDown() throws Exception {
@After
public void tearDown() throws Exception {
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);
import static org.mockito.Mockito.doReturn;
import akka.actor.ActorSystem;
import static org.mockito.Mockito.doReturn;
import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestProbe;
import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
import com.google.common.io.ByteSource;
import java.io.IOException;
import java.io.InputStream;
import com.google.common.io.ByteSource;
import java.io.IOException;
import java.io.InputStream;
@AfterClass
public static void tearDownClass() {
@AfterClass
public static void tearDownClass() {
- JavaTestKit.shutdownActorSystem(ACTOR_SYSTEM, Boolean.TRUE);
+ TestKit.shutdownActorSystem(ACTOR_SYSTEM, true);
}
void setupMockFiledBackedStream(final FileBackedOutputStream mockOutputStream) throws IOException {
}
void setupMockFiledBackedStream(final FileBackedOutputStream mockOutputStream) throws IOException {
package org.opendaylight.controller.cluster.messaging;
import static org.junit.Assert.assertEquals;
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.actor.ActorSystem;
import akka.actor.ExtendedActorSystem;
import akka.serialization.JavaSerializer;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestProbe;
import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
import org.apache.commons.lang.SerializationUtils;
import org.junit.After;
import org.junit.Before;
import org.apache.commons.lang.SerializationUtils;
import org.junit.After;
import org.junit.Before;
@After
public void tearDown() {
@After
public void tearDown() {
- JavaTestKit.shutdownActorSystem(actorSystem, Boolean.TRUE);
+ TestKit.shutdownActorSystem(actorSystem, true);
assertEquals("getIdentifier", expected.getIdentifier(), cloned.getIdentifier());
assertEquals("getSliceIndex", expected.getSliceIndex(), cloned.getSliceIndex());
assertEquals("getSendTo", expected.getSendTo(), cloned.getSendTo());
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() {
}
private void testFailure() {
assertEquals("getIdentifier", expected.getIdentifier(), cloned.getIdentifier());
assertEquals("getSliceIndex", expected.getSliceIndex(), cloned.getSliceIndex());
assertEquals("getSendTo", expected.getSendTo(), cloned.getSendTo());
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(),
assertEquals("getFailure message", expected.getFailure().get().getMessage(),
cloned.getFailure().get().getMessage());
assertEquals("getFailure isRetriable", expected.getFailure().get().isRetriable(),
import akka.actor.ActorSystem;
import akka.actor.ExtendedActorSystem;
import akka.serialization.JavaSerializer;
import akka.actor.ActorSystem;
import akka.actor.ExtendedActorSystem;
import akka.serialization.JavaSerializer;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestProbe;
import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
import org.apache.commons.lang.SerializationUtils;
import org.junit.After;
import org.junit.Before;
import org.apache.commons.lang.SerializationUtils;
import org.junit.After;
import org.junit.Before;
@After
public void tearDown() {
@After
public void tearDown() {
- JavaTestKit.shutdownActorSystem(actorSystem, Boolean.TRUE);
+ TestKit.shutdownActorSystem(actorSystem, Boolean.TRUE);
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestProbe;
import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
@AfterClass
public static void staticTearDown() {
@AfterClass
public static void staticTearDown() {
- JavaTestKit.shutdownActorSystem(ACTOR_SYSTEM, Boolean.TRUE);
+ TestKit.shutdownActorSystem(ACTOR_SYSTEM, true);
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestProbe;
import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
import java.util.ArrayList;
import java.util.List;
import org.junit.After;
import java.util.ArrayList;
import java.util.List;
import org.junit.After;
@After
public void tearDown() throws Exception {
@After
public void tearDown() throws Exception {
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);
import akka.persistence.SnapshotSelectionCriteria;
import akka.persistence.serialization.Snapshot;
import akka.persistence.serialization.SnapshotSerializer;
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;
import com.typesafe.config.ConfigFactory;
import java.io.File;
import java.io.FileOutputStream;
@AfterClass
public static void staticCleanup() {
FileUtils.deleteQuietly(SNAPSHOT_DIR);
@AfterClass
public static void staticCleanup() {
FileUtils.deleteQuietly(SNAPSHOT_DIR);
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);
SnapshotMetadata metadata3 = new SnapshotMetadata(PERSISTENCE_ID, 1, 3000);
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);
snapshotStore.tell(new LoadSnapshot(PERSISTENCE_ID,
SnapshotSelectionCriteria.latest(), Long.MAX_VALUE), probe.getRef());
LoadSnapshotResult result = probe.expectMsgClass(LoadSnapshotResult.class);
@Test
public void testDoLoadAsyncWithNoSnapshots() throws IOException {
@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);
snapshotStore.tell(new LoadSnapshot(PERSISTENCE_ID,
SnapshotSelectionCriteria.latest(), Long.MAX_VALUE), probe.getRef());
LoadSnapshotResult result = probe.expectMsgClass(LoadSnapshotResult.class);
SnapshotMetadata metadata = new SnapshotMetadata(PERSISTENCE_ID, 0, 1000);
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);
snapshotStore.tell(new LoadSnapshot(PERSISTENCE_ID,
SnapshotSelectionCriteria.latest(), Long.MAX_VALUE), probe.getRef());
LoadSnapshotResult result = probe.expectMsgClass(LoadSnapshotResult.class);
public void testDoLoadAsyncWithFailure() throws Throwable {
createSnapshotFile(PERSISTENCE_ID, null, 1, 2000);
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);
snapshotStore.tell(new SnapshotProtocol.LoadSnapshot(PERSISTENCE_ID,
SnapshotSelectionCriteria.latest(), Long.MAX_VALUE), probe.getRef());
LoadSnapshotFailed failed = probe.expectMsgClass(LoadSnapshotFailed.class);
SnapshotMetadata metadata = new SnapshotMetadata(PERSISTENCE_ID, 1, 1000);
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);
snapshotStore.tell(new LoadSnapshot(PERSISTENCE_ID,
SnapshotSelectionCriteria.latest(), Long.MAX_VALUE), probe.getRef());
LoadSnapshotResult result = probe.expectMsgClass(LoadSnapshotResult.class);
import akka.actor.ActorRef;
import akka.actor.ActorSelection;
import akka.actor.ActorSystem;
import akka.actor.ActorRef;
import akka.actor.ActorSelection;
import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestProbe;
import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
import java.util.Collection;
import java.util.Collections;
import java.util.function.Function;
import java.util.Collection;
import java.util.Collections;
import java.util.function.Function;
@After
public void tearDown() throws Exception {
@After
public void tearDown() throws Exception {
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);
import akka.actor.ActorSelection;
import akka.actor.ActorSystem;
import akka.actor.Status;
import akka.actor.ActorSelection;
import akka.actor.ActorSystem;
import akka.actor.Status;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestProbe;
import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
import java.util.Collections;
import java.util.Optional;
import org.junit.After;
import java.util.Collections;
import java.util.Optional;
import org.junit.After;
@After
public void tearDown() throws Exception {
@After
public void tearDown() throws Exception {
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);
import static org.mockito.Mockito.when;
import akka.actor.ActorSystem;
import static org.mockito.Mockito.when;
import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestProbe;
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;
import com.google.common.base.Ticker;
import com.google.common.primitives.UnsignedLong;
import java.util.ArrayList;
@After
public void tearDown() throws Exception {
@After
public void tearDown() throws Exception {
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);
import static org.opendaylight.controller.cluster.databroker.actors.dds.TestUtils.CLIENT_ID;
import akka.actor.ActorSystem;
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.TestProbe;
+import akka.testkit.javadsl.TestKit;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@After
public void tearDown() throws Exception {
@After
public void tearDown() throws Exception {
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);
import static org.opendaylight.controller.cluster.databroker.actors.dds.TestUtils.getWithTimeout;
import akka.actor.ActorSystem;
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.TestProbe;
+import akka.testkit.javadsl.TestKit;
import com.google.common.primitives.UnsignedLong;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
import com.google.common.primitives.UnsignedLong;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
@After
public void tearDown() throws Exception {
@After
public void tearDown() throws Exception {
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);
}
@Test
public void testCanCommit() throws Exception {
testOpSuccess(ClientTransactionCommitCohort::canCommit, this::expectCanCommit,
}
@Test
public void testCanCommit() throws Exception {
testOpSuccess(ClientTransactionCommitCohort::canCommit, this::expectCanCommit,
- this::replyCanCommitSuccess, true);
+ this::replyCanCommitSuccess, Boolean.TRUE);
import static org.opendaylight.controller.cluster.databroker.actors.dds.TestUtils.getWithTimeout;
import akka.actor.ActorSystem;
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.TestProbe;
+import akka.testkit.javadsl.TestKit;
import com.google.common.primitives.UnsignedLong;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.Optional;
import com.google.common.primitives.UnsignedLong;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.Optional;
@After
public void tearDown() throws Exception {
@After
public void tearDown() throws Exception {
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);
import akka.actor.ActorRef;
import akka.actor.ActorSelection;
import akka.actor.ActorSystem;
import akka.actor.ActorRef;
import akka.actor.ActorSelection;
import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestProbe;
import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
import java.util.Collections;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.ExecutionException;
import java.util.Collections;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.ExecutionException;
@After
public void tearDown() throws Exception {
@After
public void tearDown() throws Exception {
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);
import static org.opendaylight.controller.cluster.databroker.actors.dds.TestUtils.CLIENT_ID;
import akka.actor.ActorSystem;
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.TestProbe;
+import akka.testkit.javadsl.TestKit;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@After
public void tearDown() throws Exception {
@After
public void tearDown() throws Exception {
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);
package org.opendaylight.controller.cluster.datastore;
import akka.actor.ActorSystem;
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;
import java.io.IOException;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@AfterClass
public static void tearDownClass() throws IOException {
@AfterClass
public static void tearDownClass() throws IOException {
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);
package org.opendaylight.controller.cluster.datastore;
import akka.actor.ActorSystem;
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;
import com.typesafe.config.ConfigFactory;
import java.io.IOException;
import org.junit.AfterClass;
@AfterClass
public static void tearDownClass() throws IOException {
@AfterClass
public static void tearDownClass() throws IOException {
- JavaTestKit.shutdownActorSystem(system, null, Boolean.TRUE);
+ TestKit.shutdownActorSystem(system, Boolean.TRUE);
package org.opendaylight.controller.cluster.datastore;
import akka.actor.ActorSystem;
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;
import com.typesafe.config.ConfigFactory;
import java.util.ArrayList;
import java.util.Collection;
@After
public void actorSystemCleanup() {
for (final ActorSystem system : actorSystems) {
@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;
ActorSystem system = ActorSystem.create(name, ConfigFactory.load().getConfig(config));
actorSystems.add(system);
return system;
import akka.actor.ActorSystem;
import akka.actor.Props;
import akka.dispatch.Futures;
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;
import akka.util.Timeout;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Timer;
@AfterClass
public static void tearDownClass() throws IOException {
@AfterClass
public static void tearDownClass() throws IOException {
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);
import akka.actor.Terminated;
import akka.dispatch.ExecutionContexts;
import akka.dispatch.Futures;
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;
import akka.util.Timeout;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.Uninterruptibles;
@Test(timeout = 10000)
public void testSuccessfulRegistration() {
@Test(timeout = 10000)
public void testSuccessfulRegistration() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
ActorContext actorContext = new ActorContext(getSystem(), getRef(),
mock(ClusterWrapper.class), mock(Configuration.class));
{
ActorContext actorContext = new ActorContext(getSystem(), getRef(),
mock(ClusterWrapper.class), mock(Configuration.class));
@Test(timeout = 10000)
public void testSuccessfulRegistrationForClusteredListener() {
@Test(timeout = 10000)
public void testSuccessfulRegistrationForClusteredListener() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
ActorContext actorContext = new ActorContext(getSystem(), getRef(),
mock(ClusterWrapper.class), mock(Configuration.class));
{
ActorContext actorContext = new ActorContext(getSystem(), getRef(),
mock(ClusterWrapper.class), mock(Configuration.class));
@Test(timeout = 10000)
public void testLocalShardNotFound() {
@Test(timeout = 10000)
public void testLocalShardNotFound() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
ActorContext actorContext = new ActorContext(getSystem(), getRef(),
mock(ClusterWrapper.class), mock(Configuration.class));
{
ActorContext actorContext = new ActorContext(getSystem(), getRef(),
mock(ClusterWrapper.class), mock(Configuration.class));
@Test(timeout = 10000)
public void testLocalShardNotInitialized() {
@Test(timeout = 10000)
public void testLocalShardNotInitialized() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
ActorContext actorContext = new ActorContext(getSystem(), getRef(),
mock(ClusterWrapper.class), mock(Configuration.class));
{
ActorContext actorContext = new ActorContext(getSystem(), getRef(),
mock(ClusterWrapper.class), mock(Configuration.class));
reply(new NotInitializedException("not initialized"));
reply(new NotInitializedException("not initialized"));
- new Within(duration("1 seconds")) {
- @Override
- protected void run() {
- expectNoMsg();
- }
- };
-
+ expectNoMsg(duration("1 seconds"));
@Test
public void testFailedRegistration() {
@Test
public void testFailedRegistration() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
ActorSystem mockActorSystem = mock(ActorSystem.class);
{
ActorSystem mockActorSystem = mock(ActorSystem.class);
@Test
public void testCloseBeforeRegistration() {
@Test
public void testCloseBeforeRegistration() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
ActorContext actorContext = mock(ActorContext.class);
{
ActorContext actorContext = mock(ActorContext.class);
import akka.actor.ActorRef;
import akka.actor.DeadLetter;
import akka.actor.Props;
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;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testDataChangedWhenNotificationsAreEnabled() {
@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);
{
final AsyncDataChangeEvent mockChangeEvent = Mockito.mock(AsyncDataChangeEvent.class);
final AsyncDataChangeListener mockListener = Mockito.mock(AsyncDataChangeListener.class);
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testDataChangedWhenNotificationsAreDisabled() {
@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);
{
final AsyncDataChangeEvent mockChangeEvent = Mockito.mock(AsyncDataChangeEvent.class);
final AsyncDataChangeListener mockListener = Mockito.mock(AsyncDataChangeListener.class);
subject.tell(new DataChanged(mockChangeEvent), getRef());
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;
+ });
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testDataChangedWithNoSender() {
@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);
{
final AsyncDataChangeEvent mockChangeEvent = Mockito.mock(AsyncDataChangeEvent.class);
final AsyncDataChangeListener mockListener = Mockito.mock(AsyncDataChangeListener.class);
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testDataChangedWithListenerRuntimeEx() {
@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);
{
final AsyncDataChangeEvent mockChangeEvent1 = Mockito.mock(AsyncDataChangeEvent.class);
final AsyncDataChangeEvent mockChangeEvent2 = Mockito.mock(AsyncDataChangeEvent.class);
import akka.actor.ActorRef;
import akka.actor.DeadLetter;
import akka.actor.Props;
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;
import com.google.common.collect.ImmutableList;
import org.junit.Assert;
import org.junit.Test;
@Test
public void testDataChangedWhenNotificationsAreEnabled() {
@Test
public void testDataChangedWhenNotificationsAreEnabled() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final DataTreeCandidate mockTreeCandidate = Mockito.mock(DataTreeCandidate.class);
final ImmutableList<DataTreeCandidate> mockCandidates = ImmutableList.of(mockTreeCandidate);
{
final DataTreeCandidate mockTreeCandidate = Mockito.mock(DataTreeCandidate.class);
final ImmutableList<DataTreeCandidate> mockCandidates = ImmutableList.of(mockTreeCandidate);
@Test
public void testDataChangedWhenNotificationsAreDisabled() {
@Test
public void testDataChangedWhenNotificationsAreDisabled() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final DataTreeCandidate mockTreeCandidate = Mockito.mock(DataTreeCandidate.class);
final ImmutableList<DataTreeCandidate> mockCandidates = ImmutableList.of(mockTreeCandidate);
{
final DataTreeCandidate mockTreeCandidate = Mockito.mock(DataTreeCandidate.class);
final ImmutableList<DataTreeCandidate> mockCandidates = ImmutableList.of(mockTreeCandidate);
subject.tell(new DataTreeChanged(mockCandidates), getRef());
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() {
}
};
}
@Test
public void testDataChangedWithNoSender() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final DataTreeCandidate mockTreeCandidate = Mockito.mock(DataTreeCandidate.class);
final ImmutableList<DataTreeCandidate> mockCandidates = ImmutableList.of(mockTreeCandidate);
{
final DataTreeCandidate mockTreeCandidate = Mockito.mock(DataTreeCandidate.class);
final ImmutableList<DataTreeCandidate> mockCandidates = ImmutableList.of(mockTreeCandidate);
@Test
public void testDataChangedWithListenerRuntimeEx() {
@Test
public void testDataChangedWithListenerRuntimeEx() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final DataTreeCandidate mockTreeCandidate1 = Mockito.mock(DataTreeCandidate.class);
final ImmutableList<DataTreeCandidate> mockCandidates1 = ImmutableList.of(mockTreeCandidate1);
{
final DataTreeCandidate mockTreeCandidate1 = Mockito.mock(DataTreeCandidate.class);
final ImmutableList<DataTreeCandidate> mockCandidates1 = ImmutableList.of(mockTreeCandidate1);
import akka.actor.Terminated;
import akka.dispatch.ExecutionContexts;
import akka.dispatch.Futures;
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;
import akka.util.Timeout;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.Uninterruptibles;
@Test(timeout = 10000)
public void testSuccessfulRegistration() {
@Test(timeout = 10000)
public void testSuccessfulRegistration() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
ActorContext actorContext = new ActorContext(getSystem(), getRef(), mock(ClusterWrapper.class),
mock(Configuration.class));
{
ActorContext actorContext = new ActorContext(getSystem(), getRef(), mock(ClusterWrapper.class),
mock(Configuration.class));
@Test(timeout = 10000)
public void testSuccessfulRegistrationForClusteredListener() {
@Test(timeout = 10000)
public void testSuccessfulRegistrationForClusteredListener() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
ActorContext actorContext = new ActorContext(getSystem(), getRef(), mock(ClusterWrapper.class),
mock(Configuration.class));
{
ActorContext actorContext = new ActorContext(getSystem(), getRef(), mock(ClusterWrapper.class),
mock(Configuration.class));
@Test(timeout = 10000)
public void testLocalShardNotFound() {
@Test(timeout = 10000)
public void testLocalShardNotFound() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
ActorContext actorContext = new ActorContext(getSystem(), getRef(), mock(ClusterWrapper.class),
mock(Configuration.class));
{
ActorContext actorContext = new ActorContext(getSystem(), getRef(), mock(ClusterWrapper.class),
mock(Configuration.class));
@Test(timeout = 10000)
public void testLocalShardNotInitialized() {
@Test(timeout = 10000)
public void testLocalShardNotInitialized() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
ActorContext actorContext = new ActorContext(getSystem(), getRef(), mock(ClusterWrapper.class),
mock(Configuration.class));
{
ActorContext actorContext = new ActorContext(getSystem(), getRef(), mock(ClusterWrapper.class),
mock(Configuration.class));
reply(new NotInitializedException("not initialized"));
reply(new NotInitializedException("not initialized"));
- new Within(duration("1 seconds")) {
- @Override
- protected void run() {
- expectNoMsg();
- }
- };
+ within(duration("1 seconds"), () -> {
+ expectNoMsg();
+ return null;
+ });
@Test
public void testFailedRegistration() {
@Test
public void testFailedRegistration() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
ActorSystem mockActorSystem = mock(ActorSystem.class);
{
ActorSystem mockActorSystem = mock(ActorSystem.class);
@Test
public void testCloseBeforeRegistration() {
@Test
public void testCloseBeforeRegistration() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
ActorContext actorContext = mock(ActorContext.class);
{
ActorContext actorContext = mock(ActorContext.class);
import akka.actor.ActorRef;
import akka.actor.ActorSelection;
import akka.pattern.Patterns;
import akka.actor.ActorRef;
import akka.actor.ActorSelection;
import akka.pattern.Patterns;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestActorRef;
import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
import akka.util.Timeout;
import java.util.AbstractMap.SimpleEntry;
import java.util.Map.Entry;
import akka.util.Timeout;
import java.util.AbstractMap.SimpleEntry;
import java.util.Map.Entry;
listener.verifyNotifiedData(TEST_PATH);
listener.reset(1);
listener.verifyNotifiedData(TEST_PATH);
listener.reset(1);
- JavaTestKit kit = new JavaTestKit(getSystem());
+ TestKit kit = new TestKit(getSystem());
entry.getValue().tell(CloseDataTreeNotificationListenerRegistration.getInstance(), kit.getRef());
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);
writeToStore(shard.getDataStore(), TEST_PATH, ImmutableNodes.containerNode(TEST_QNAME));
listener.verifyNoNotifiedData(TEST_PATH);
import akka.actor.Address;
import akka.actor.AddressFromURIString;
import akka.cluster.Cluster;
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;
import com.google.common.base.Optional;
import com.google.common.base.Throwables;
import com.google.common.util.concurrent.CheckedFuture;
@AfterClass
public static void tearDownClass() throws IOException {
@AfterClass
public static void tearDownClass() throws IOException {
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);
}
@SuppressWarnings("rawtypes")
}
@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())) {
for (Object obj: candidateCapture.getValue()) {
DOMDataTreeCandidate candidate = (DOMDataTreeCandidate)obj;
if (rootPath.equals(candidate.getRootPath().getRootIdentifier())) {
- 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());
assertNotNull("Expected candidate for path " + expTreeId.getRootIdentifier(), candidate);
assertEquals("rootPath", expTreeId, candidate.getRootPath());
assertEquals("modificationType", expType, candidate.getRootNode().getModificationType());
import akka.actor.Address;
import akka.actor.AddressFromURIString;
import akka.cluster.Cluster;
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;
import com.google.common.base.Optional;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableMap;
@After
public void tearDown() throws IOException {
@After
public void tearDown() throws IOException {
- JavaTestKit.shutdownActorSystem(system, null, Boolean.TRUE);
+ TestKit.shutdownActorSystem(system, Boolean.TRUE);
import akka.cluster.Cluster;
import akka.dispatch.Futures;
import akka.pattern.Patterns;
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;
import com.google.common.base.Optional;
import com.google.common.base.Stopwatch;
import com.google.common.base.Supplier;
leaderDistributedDataStore.close();
}
leaderDistributedDataStore.close();
}
- JavaTestKit.shutdownActorSystem(leaderSystem);
- JavaTestKit.shutdownActorSystem(followerSystem);
- JavaTestKit.shutdownActorSystem(follower2System);
+ TestKit.shutdownActorSystem(leaderSystem);
+ TestKit.shutdownActorSystem(followerSystem);
+ TestKit.shutdownActorSystem(follower2System);
InMemoryJournal.clear();
InMemorySnapshotStore.clear();
InMemoryJournal.clear();
InMemorySnapshotStore.clear();
Uninterruptibles.sleepUninterruptibly(50, TimeUnit.MILLISECONDS);
}
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");
final ActorSystem newSystem = newActorSystem("reinstated-member2", "Member2");
sendDatastoreContextUpdate(followerDistributedDataStore, followerDatastoreContextBuilder
.shardElectionTimeoutFactor(1).customRaftPolicyImplementation(null));
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);
Cluster.get(followerSystem).leave(MEMBER_1_ADDRESS);
followerTestKit.waitUntilNoLeader(followerDistributedDataStore.getActorContext(), CARS);
// Shutdown the leader and try to create a new tx.
// 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);
followerDatastoreContextBuilder.operationTimeoutInMillis(50).shardElectionTimeoutFactor(1);
sendDatastoreContextUpdate(followerDistributedDataStore, followerDatastoreContextBuilder);
// Shutdown the leader and try to create a new tx.
// 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);
Cluster.get(followerSystem).leave(MEMBER_1_ADDRESS);
// Shutdown the leader and try to create a new tx.
// 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);
Cluster.get(followerSystem).leave(MEMBER_1_ADDRESS);
import static org.junit.Assert.assertNull;
import akka.actor.ActorRef;
import static org.junit.Assert.assertNull;
import akka.actor.ActorRef;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestActorRef;
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;
import org.junit.Test;
import org.opendaylight.controller.cluster.notifications.LeaderStateChanged;
import org.opendaylight.controller.cluster.notifications.RegisterRoleChangeListener;
@Test
public void testHandleRegisterRoleChangeListener() throws Exception {
@Test
public void testHandleRegisterRoleChangeListener() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
String memberId = "testHandleRegisterRoleChangeListener";
ActorRef listenerActor = getSystem().actorOf(MessageCollectorActor.props());
{
String memberId = "testHandleRegisterRoleChangeListener";
ActorRef listenerActor = getSystem().actorOf(MessageCollectorActor.props());
@Test
public void testHandleRaftRoleChanged() throws Exception {
@Test
public void testHandleRaftRoleChanged() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
String memberId = "testHandleRegisterRoleChangeListenerWithNotificationSet";
ActorRef listenerActor = getSystem().actorOf(MessageCollectorActor.props());
{
String memberId = "testHandleRegisterRoleChangeListenerWithNotificationSet";
ActorRef listenerActor = getSystem().actorOf(MessageCollectorActor.props());
@Test
public void testHandleLeaderStateChanged() throws Exception {
@Test
public void testHandleLeaderStateChanged() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
String actorId = "testHandleLeaderStateChanged";
TestActorRef<RoleChangeNotifier> notifierTestActorRef = TestActorRef.create(getSystem(),
{
String actorId = "testHandleLeaderStateChanged";
TestActorRef<RoleChangeNotifier> notifierTestActorRef = TestActorRef.create(getSystem(),
public class ShardTestKit extends JavaTestKit {
private static final Logger LOG = LoggerFactory.getLogger(ShardTestKit.class);
public class ShardTestKit extends JavaTestKit {
private static final Logger LOG = LoggerFactory.getLogger(ShardTestKit.class);
- public ShardTestKit(ActorSystem actorSystem) {
+ public ShardTestKit(final ActorSystem 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
// Wait for a specific log message to show up
final boolean result =
new JavaTestKit.EventFilter<Boolean>(logLevel
}
@SuppressWarnings("checkstyle:IllegalCatch")
}
@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));
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));
}
@SuppressWarnings("checkstyle:IllegalCatch")
}
@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++) {
FiniteDuration duration = Duration.create(100, TimeUnit.MILLISECONDS);
Object lastResponse = null;
for (int i = 0; i < 20 * 5; i++) {
import akka.actor.Status.Failure;
import akka.actor.Terminated;
import akka.dispatch.Dispatchers;
import akka.actor.Status.Failure;
import akka.actor.Terminated;
import akka.dispatch.Dispatchers;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestActorRef;
import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
import com.google.common.base.Throwables;
import java.util.concurrent.TimeUnit;
import org.junit.Before;
import com.google.common.base.Throwables;
import java.util.concurrent.TimeUnit;
import org.junit.Before;
@Test
public void testOnReceiveReadData() throws Exception {
@Test
public void testOnReceiveReadData() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
testOnReceiveReadData(newTransactionActor(RO, readOnlyTransaction(), "testReadDataRO"));
{
testOnReceiveReadData(newTransactionActor(RO, readOnlyTransaction(), "testReadDataRO"));
@Test
public void testOnReceiveReadDataWhenDataNotFound() throws Exception {
@Test
public void testOnReceiveReadDataWhenDataNotFound() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
testOnReceiveReadDataWhenDataNotFound(
newTransactionActor(RO, readOnlyTransaction(), "testReadDataWhenDataNotFoundRO"));
{
testOnReceiveReadDataWhenDataNotFound(
newTransactionActor(RO, readOnlyTransaction(), "testReadDataWhenDataNotFoundRO"));
@Test
public void testOnReceiveDataExistsPositive() throws Exception {
@Test
public void testOnReceiveDataExistsPositive() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
testOnReceiveDataExistsPositive(
newTransactionActor(RO, readOnlyTransaction(), "testDataExistsPositiveRO"));
{
testOnReceiveDataExistsPositive(
newTransactionActor(RO, readOnlyTransaction(), "testDataExistsPositiveRO"));
@Test
public void testOnReceiveDataExistsNegative() throws Exception {
@Test
public void testOnReceiveDataExistsNegative() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
testOnReceiveDataExistsNegative(
newTransactionActor(RO, readOnlyTransaction(), "testDataExistsNegativeRO"));
{
testOnReceiveDataExistsNegative(
newTransactionActor(RO, readOnlyTransaction(), "testDataExistsNegativeRO"));
@Test
public void testOnReceiveBatchedModifications() throws Exception {
@Test
public void testOnReceiveBatchedModifications() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
ShardDataTreeTransactionParent parent = Mockito.mock(ShardDataTreeTransactionParent.class);
DataTreeModification mockModification = Mockito.mock(DataTreeModification.class);
{
ShardDataTreeTransactionParent parent = Mockito.mock(ShardDataTreeTransactionParent.class);
DataTreeModification mockModification = Mockito.mock(DataTreeModification.class);
@Test
public void testOnReceiveBatchedModificationsReadyWithoutImmediateCommit() throws Exception {
@Test
public void testOnReceiveBatchedModificationsReadyWithoutImmediateCommit() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final ActorRef transaction = newTransactionActor(WO, readWriteTransaction(),
"testOnReceiveBatchedModificationsReadyWithoutImmediateCommit");
{
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;
watcher.watch(transaction);
YangInstanceIdentifier writePath = TestModel.TEST_PATH;
@Test
public void testOnReceiveBatchedModificationsReadyWithImmediateCommit() throws Exception {
@Test
public void testOnReceiveBatchedModificationsReadyWithImmediateCommit() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final ActorRef transaction = newTransactionActor(WO, readWriteTransaction(),
"testOnReceiveBatchedModificationsReadyWithImmediateCommit");
{
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;
watcher.watch(transaction);
YangInstanceIdentifier writePath = TestModel.TEST_PATH;
@Test(expected = TestException.class)
public void testOnReceiveBatchedModificationsFailure() throws Exception {
@Test(expected = TestException.class)
public void testOnReceiveBatchedModificationsFailure() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
ShardDataTreeTransactionParent parent = Mockito.mock(ShardDataTreeTransactionParent.class);
{
ShardDataTreeTransactionParent parent = Mockito.mock(ShardDataTreeTransactionParent.class);
final ActorRef transaction = newTransactionActor(RW, mockWriteTx,
"testOnReceiveBatchedModificationsFailure");
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;
watcher.watch(transaction);
YangInstanceIdentifier path = TestModel.TEST_PATH;
@Test(expected = IllegalStateException.class)
public void testOnReceiveBatchedModificationsReadyWithIncorrectTotalMessageCount() throws Exception {
@Test(expected = IllegalStateException.class)
public void testOnReceiveBatchedModificationsReadyWithIncorrectTotalMessageCount() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final ActorRef transaction = newTransactionActor(WO, readWriteTransaction(),
"testOnReceiveBatchedModificationsReadyWithIncorrectTotalMessageCount");
{
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(),
watcher.watch(transaction);
BatchedModifications batched = new BatchedModifications(nextTransactionId(),
@Test
public void testReadWriteTxOnReceiveCloseTransaction() throws Exception {
@Test
public void testReadWriteTxOnReceiveCloseTransaction() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final ActorRef transaction = newTransactionActor(RW, readWriteTransaction(),
"testReadWriteTxOnReceiveCloseTransaction");
{
final ActorRef transaction = newTransactionActor(RW, readWriteTransaction(),
"testReadWriteTxOnReceiveCloseTransaction");
@Test
public void testWriteOnlyTxOnReceiveCloseTransaction() throws Exception {
@Test
public void testWriteOnlyTxOnReceiveCloseTransaction() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final ActorRef transaction = newTransactionActor(WO, readWriteTransaction(),
"testWriteTxOnReceiveCloseTransaction");
{
final ActorRef transaction = newTransactionActor(WO, readWriteTransaction(),
"testWriteTxOnReceiveCloseTransaction");
@Test
public void testReadOnlyTxOnReceiveCloseTransaction() throws Exception {
@Test
public void testReadOnlyTxOnReceiveCloseTransaction() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final ActorRef transaction = newTransactionActor(TransactionType.READ_ONLY, readOnlyTransaction(),
"testReadOnlyTxOnReceiveCloseTransaction");
{
final ActorRef transaction = newTransactionActor(TransactionType.READ_ONLY, readOnlyTransaction(),
"testReadOnlyTxOnReceiveCloseTransaction");
datastoreContext = DatastoreContext.newBuilder().shardTransactionIdleTimeout(
500, TimeUnit.MILLISECONDS).build();
datastoreContext = DatastoreContext.newBuilder().shardTransactionIdleTimeout(
500, TimeUnit.MILLISECONDS).build();
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final ActorRef transaction = newTransactionActor(RW, readWriteTransaction(),
"testShardTransactionInactivity");
{
final ActorRef transaction = newTransactionActor(RW, readWriteTransaction(),
"testShardTransactionInactivity");
import static org.mockito.Mockito.timeout;
import akka.actor.ActorRef;
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;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
@Test
public void testOnReceiveCloseListenerRegistrationAfterSetRegistration() throws Exception {
@Test
public void testOnReceiveCloseListenerRegistrationAfterSetRegistration() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final ActorRef subject = getSystem().actorOf(DataTreeNotificationListenerRegistrationActor.props(),
"testOnReceiveCloseListenerRegistrationAfterSetRegistration");
{
final ActorRef subject = getSystem().actorOf(DataTreeNotificationListenerRegistrationActor.props(),
"testOnReceiveCloseListenerRegistrationAfterSetRegistration");
@Test
public void testOnReceiveCloseListenerRegistrationBeforeSetRegistration() throws Exception {
@Test
public void testOnReceiveCloseListenerRegistrationBeforeSetRegistration() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final ActorRef subject = getSystem().actorOf(DataTreeNotificationListenerRegistrationActor.props(),
"testOnReceiveSetRegistrationAfterPriorClose");
{
final ActorRef subject = getSystem().actorOf(DataTreeNotificationListenerRegistrationActor.props(),
"testOnReceiveSetRegistrationAfterPriorClose");
@Test
public void testOnReceiveSetRegistrationAfterPriorClose() throws Exception {
@Test
public void testOnReceiveSetRegistrationAfterPriorClose() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
DataTreeNotificationListenerRegistrationActor.killDelay = 1000;
final ListenerRegistration<?> mockListenerReg2 = Mockito.mock(ListenerRegistration.class);
{
DataTreeNotificationListenerRegistrationActor.killDelay = 1000;
final ListenerRegistration<?> mockListenerReg2 = Mockito.mock(ListenerRegistration.class);
import static org.junit.Assert.assertNotNull;
import akka.actor.ActorRef;
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;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
private static void testSerializeSnapshot(final String testName, final ShardDataTreeSnapshot snapshot,
final boolean withInstallSnapshot) throws Exception {
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);
{
final ActorRef snapshotActor = getSystem().actorOf(ShardSnapshotActor.props(), testName);
watch(snapshotActor);
package org.opendaylight.controller.cluster.datastore.entityownership;
import akka.actor.ActorSystem;
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;
import com.typesafe.config.ConfigFactory;
import java.io.IOException;
import org.junit.AfterClass;
@AfterClass
public static void tearDownClass() throws IOException {
@AfterClass
public static void tearDownClass() throws IOException {
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);
import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.entityOwnersWithCandidate;
import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.entityPath;
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;
import com.google.common.collect.ImmutableSet;
import java.util.concurrent.TimeUnit;
import org.junit.Before;
@Test
public void testOnDataTreeChanged() throws Exception {
@Test
public void testOnDataTreeChanged() throws Exception {
- JavaTestKit kit = new JavaTestKit(getSystem());
+ TestKit kit = new TestKit(getSystem());
new CandidateListChangeListener(kit.getRef(), "test").init(shardDataTree);
new CandidateListChangeListener(kit.getRef(), "test").init(shardDataTree);
import akka.actor.Status.Success;
import akka.cluster.Cluster;
import akka.pattern.Patterns;
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;
import akka.util.Timeout;
import com.google.common.base.Optional;
import com.google.common.base.Stopwatch;
AddShardReplica addReplica = new AddShardReplica(ENTITY_OWNERSHIP_SHARD_NAME);
follower1DistributedDataStore.getActorContext().getShardManager().tell(addReplica,
follower1Node.kit().getRef());
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());
Success.class, Failure.class);
if (reply instanceof Failure) {
throw new AssertionError("AddShardReplica failed", ((Failure)reply).cause());
import akka.actor.ActorContext;
import akka.actor.ActorRef;
import akka.actor.Props;
import akka.actor.ActorContext;
import akka.actor.ActorRef;
import akka.actor.Props;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestActorRef;
import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
import com.google.common.util.concurrent.Uninterruptibles;
import java.util.ArrayList;
import java.util.List;
import com.google.common.util.concurrent.Uninterruptibles;
import java.util.ArrayList;
import java.util.List;
// Unregister all listeners and verify their listener actors are destroyed.
// 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();) {
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);
}
kit.watch(iter.next());
watchers.add(kit);
}
support.removeEntityOwnershipListener(entityType2, mockListener2);
Iterator<ActorRef> iter = listenerActors.iterator();
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());
}
assertEquals("# of listener actors", 0, actorContext.children().size());
import akka.actor.Props;
import akka.actor.Terminated;
import akka.dispatch.Dispatchers;
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;
import akka.testkit.TestActorRef;
import com.google.common.collect.ImmutableMap;
import com.google.common.util.concurrent.Uninterruptibles;
kit.watch(peer2);
peer2.tell(PoisonPill.getInstance(), ActorRef.noSender());
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());
kit.unwatch(peer2);
leader.tell(new PeerDown(peerId2.getMemberName(), peerId2.toString()), ActorRef.noSender());
kit.watch(peer1);
peer1.tell(PoisonPill.getInstance(), ActorRef.noSender());
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());
kit.unwatch(peer1);
leader.tell(new PeerDown(peerId1.getMemberName(), peerId1.toString()), ActorRef.noSender());
kit.watch(leader);
leader.tell(PoisonPill.getInstance(), ActorRef.noSender());
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);
kit.unwatch(leader);
peer2.tell(new PeerDown(leaderId.getMemberName(), leaderId.toString()), ActorRef.noSender());
peer2.tell(TimeoutNow.INSTANCE, peer2);
import akka.actor.ActorRef;
import akka.actor.Status.Failure;
import akka.actor.Terminated;
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;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@Test
public void testSuccess() {
@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());
List<String> shardList = Arrays.asList("shard1", "shard2", "shard3");
ShardManagerSnapshot shardManagerSnapshot = new ShardManagerSnapshot(shardList, Collections.emptyMap());
@Test
public void testGetSnapshotFailureReply() {
@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",
ActorRef replyActor = getSystem().actorOf(ShardManagerGetSnapshotReplyActor.props(
Arrays.asList("shard1", "shard2"), "config", null, kit.getRef(), "shard-manager",
@Test
public void testGetSnapshotTimeout() {
@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",
ActorRef replyActor = getSystem().actorOf(ShardManagerGetSnapshotReplyActor.props(
Arrays.asList("shard1"), "config", null, kit.getRef(), "shard-manager",
import akka.pattern.Patterns;
import akka.persistence.RecoveryCompleted;
import akka.serialization.Serialization;
import akka.pattern.Patterns;
import akka.persistence.RecoveryCompleted;
import akka.serialization.Serialization;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestActorRef;
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;
import akka.util.Timeout;
import com.google.common.base.Function;
import com.google.common.base.Stopwatch;
}
private static void waitForShardInitialized(final ActorRef shardManager, final String shardName,
}
private static void waitForShardInitialized(final ActorRef shardManager, final String shardName,
- final JavaTestKit kit) {
AssertionError last = null;
Stopwatch sw = Stopwatch.createStarted();
while (sw.elapsed(TimeUnit.SECONDS) <= 5) {
AssertionError last = null;
Stopwatch sw = Stopwatch.createStarted();
while (sw.elapsed(TimeUnit.SECONDS) <= 5) {
}
@SuppressWarnings("unchecked")
}
@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());
}
if (reply instanceof Failure) {
throw new AssertionError(msg + " failed", ((Failure)reply).cause());
}
- JavaTestKit kit = new JavaTestKit(getSystem());
+ TestKit kit = new TestKit(getSystem());
final ActorRef shardManager = actorFactory.createActor(Props.create(
new DelegatingShardManagerCreator(creator)).withDispatcher(Dispatchers.DefaultDispatcherId()));
final ActorRef shardManager = actorFactory.createActor(Props.create(
new DelegatingShardManagerCreator(creator)).withDispatcher(Dispatchers.DefaultDispatcherId()));
@Test
public void testOnReceiveFindPrimaryForNonExistentShard() throws Exception {
@Test
public void testOnReceiveFindPrimaryForNonExistentShard() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
@Test
public void testOnReceiveFindPrimaryForLocalLeaderShard() throws Exception {
LOG.info("testOnReceiveFindPrimaryForLocalLeaderShard starting");
@Test
public void testOnReceiveFindPrimaryForLocalLeaderShard() throws Exception {
LOG.info("testOnReceiveFindPrimaryForLocalLeaderShard starting");
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
String memberId = "member-1-shard-default-" + shardMrgIDSuffix;
{
String memberId = "member-1-shard-default-" + shardMrgIDSuffix;
@Test
public void testOnReceiveFindPrimaryForNonLocalLeaderShardBeforeMemberUp() throws Exception {
LOG.info("testOnReceiveFindPrimaryForNonLocalLeaderShardBeforeMemberUp starting");
@Test
public void testOnReceiveFindPrimaryForNonLocalLeaderShardBeforeMemberUp() throws Exception {
LOG.info("testOnReceiveFindPrimaryForNonLocalLeaderShardBeforeMemberUp starting");
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
@Test
public void testOnReceiveFindPrimaryForNonLocalLeaderShard() throws Exception {
LOG.info("testOnReceiveFindPrimaryForNonLocalLeaderShard starting");
@Test
public void testOnReceiveFindPrimaryForNonLocalLeaderShard() throws Exception {
LOG.info("testOnReceiveFindPrimaryForNonLocalLeaderShard starting");
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
@Test
public void testOnReceiveFindPrimaryForUninitializedShard() throws Exception {
@Test
public void testOnReceiveFindPrimaryForUninitializedShard() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
@Test
public void testOnReceiveFindPrimaryForInitializedShardWithNoRole() throws Exception {
@Test
public void testOnReceiveFindPrimaryForInitializedShardWithNoRole() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
@Test
public void testOnReceiveFindPrimaryForFollowerShardWithNoInitialLeaderId() throws Exception {
LOG.info("testOnReceiveFindPrimaryForFollowerShardWithNoInitialLeaderId starting");
@Test
public void testOnReceiveFindPrimaryForFollowerShardWithNoInitialLeaderId() throws Exception {
LOG.info("testOnReceiveFindPrimaryForFollowerShardWithNoInitialLeaderId starting");
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
public void testOnReceiveFindPrimaryWaitForShardLeader() throws Exception {
LOG.info("testOnReceiveFindPrimaryWaitForShardLeader starting");
datastoreContextBuilder.shardInitializationTimeout(10, TimeUnit.SECONDS);
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());
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
@Test
public void testOnReceiveFindPrimaryWaitForReadyWithUninitializedShard() throws Exception {
LOG.info("testOnReceiveFindPrimaryWaitForReadyWithUninitializedShard starting");
@Test
public void testOnReceiveFindPrimaryWaitForReadyWithUninitializedShard() throws Exception {
LOG.info("testOnReceiveFindPrimaryWaitForReadyWithUninitializedShard starting");
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
@Test
public void testOnReceiveFindPrimaryWaitForReadyWithCandidateShard() throws Exception {
LOG.info("testOnReceiveFindPrimaryWaitForReadyWithCandidateShard starting");
@Test
public void testOnReceiveFindPrimaryWaitForReadyWithCandidateShard() throws Exception {
LOG.info("testOnReceiveFindPrimaryWaitForReadyWithCandidateShard starting");
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
@Test
public void testOnReceiveFindPrimaryWaitForReadyWithIsolatedLeaderShard() throws Exception {
LOG.info("testOnReceiveFindPrimaryWaitForReadyWithIsolatedLeaderShard starting");
@Test
public void testOnReceiveFindPrimaryWaitForReadyWithIsolatedLeaderShard() throws Exception {
LOG.info("testOnReceiveFindPrimaryWaitForReadyWithIsolatedLeaderShard starting");
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
@Test
public void testOnReceiveFindPrimaryWaitForReadyWithNoRoleShard() throws Exception {
LOG.info("testOnReceiveFindPrimaryWaitForReadyWithNoRoleShard starting");
@Test
public void testOnReceiveFindPrimaryWaitForReadyWithNoRoleShard() throws Exception {
LOG.info("testOnReceiveFindPrimaryWaitForReadyWithNoRoleShard starting");
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
new ClusterWrapperImpl(system2)).props().withDispatcher(
Dispatchers.DefaultDispatcherId()), shardManagerID);
new ClusterWrapperImpl(system2)).props().withDispatcher(
Dispatchers.DefaultDispatcherId()), shardManagerID);
- new JavaTestKit(system1) {
{
shardManager1.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
shardManager2.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
{
shardManager1.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
shardManager2.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
new ClusterWrapperImpl(system2)).props().withDispatcher(
Dispatchers.DefaultDispatcherId()), shardManagerID);
new ClusterWrapperImpl(system2)).props().withDispatcher(
Dispatchers.DefaultDispatcherId()), shardManagerID);
- new JavaTestKit(system1) {
{
shardManager1.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
shardManager2.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
{
shardManager1.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
shardManager2.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
new ClusterWrapperImpl(system2)).props().withDispatcher(
Dispatchers.DefaultDispatcherId()), shardManagerID);
new ClusterWrapperImpl(system2)).props().withDispatcher(
Dispatchers.DefaultDispatcherId()), shardManagerID);
- new JavaTestKit(system1) {
{
shardManager1.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
shardManager2.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
{
shardManager1.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
shardManager2.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
new ClusterWrapperImpl(system2)).props().withDispatcher(
Dispatchers.DefaultDispatcherId()), shardManagerID);
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());
{
shardManager256.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
shardManager2.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
@Test
public void testOnReceiveFindLocalShardForNonExistentShard() throws Exception {
@Test
public void testOnReceiveFindLocalShardForNonExistentShard() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
@Test
public void testOnReceiveFindLocalShardForExistentShard() throws Exception {
@Test
public void testOnReceiveFindLocalShardForExistentShard() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
@Test
public void testOnReceiveFindLocalShardForNotInitializedShard() throws Exception {
@Test
public void testOnReceiveFindLocalShardForNotInitializedShard() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
@Test
public void testOnReceiveFindLocalShardWaitForShardInitialized() throws Exception {
LOG.info("testOnReceiveFindLocalShardWaitForShardInitialized starting");
@Test
public void testOnReceiveFindLocalShardWaitForShardInitialized() throws Exception {
LOG.info("testOnReceiveFindLocalShardWaitForShardInitialized starting");
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
@Test
public void testRoleChangeNotificationToFollowerWithShardLeaderStateChangedReleaseReady() throws Exception {
@Test
public void testRoleChangeNotificationToFollowerWithShardLeaderStateChangedReleaseReady() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
TestShardManager shardManager = newTestShardManager();
{
TestShardManager shardManager = newTestShardManager();
@Test
public void testReadyCountDownForMemberUpAfterLeaderStateChanged() throws Exception {
@Test
public void testReadyCountDownForMemberUpAfterLeaderStateChanged() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
TestShardManager shardManager = newTestShardManager();
{
TestShardManager shardManager = newTestShardManager();
@Test
public void testOnReceiveSwitchShardBehavior() throws Exception {
@Test
public void testOnReceiveSwitchShardBehavior() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
@Test
public void testOnCreateShard() {
LOG.info("testOnCreateShard starting");
@Test
public void testOnCreateShard() {
LOG.info("testOnCreateShard starting");
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
datastoreContextBuilder.shardInitializationTimeout(1, TimeUnit.MINUTES).persistent(true);
{
datastoreContextBuilder.shardInitializationTimeout(1, TimeUnit.MINUTES).persistent(true);
@Test
public void testOnCreateShardWithLocalMemberNotInShardConfig() {
LOG.info("testOnCreateShardWithLocalMemberNotInShardConfig starting");
@Test
public void testOnCreateShardWithLocalMemberNotInShardConfig() {
LOG.info("testOnCreateShardWithLocalMemberNotInShardConfig starting");
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
datastoreContextBuilder.shardInitializationTimeout(1, TimeUnit.MINUTES).persistent(true);
{
datastoreContextBuilder.shardInitializationTimeout(1, TimeUnit.MINUTES).persistent(true);
@Test
public void testOnCreateShardWithNoInitialSchemaContext() {
LOG.info("testOnCreateShardWithNoInitialSchemaContext starting");
@Test
public void testOnCreateShardWithNoInitialSchemaContext() {
LOG.info("testOnCreateShardWithNoInitialSchemaContext starting");
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
ActorRef shardManager = actorFactory
.createActor(newShardMgrProps(new ConfigurationImpl(new EmptyModuleShardConfigProvider()))
{
ActorRef shardManager = actorFactory
.createActor(newShardMgrProps(new ConfigurationImpl(new EmptyModuleShardConfigProvider()))
@Test
public void testGetSnapshot() throws Exception {
LOG.info("testGetSnapshot starting");
@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"))
MockConfiguration mockConfig = new MockConfiguration(ImmutableMap.<String, List<String>>builder()
.put("shard1", Arrays.asList("member-1")).put("shard2", Arrays.asList("member-1"))
- JavaTestKit mockShardLeaderKit = new JavaTestKit(getSystem());
+ TestKit mockShardLeaderKit = new TestKit(getSystem());
TestShardManager shardManagerInstance = shardManager.underlyingActor();
shardManagerInstance.setMessageInterceptor(newFindPrimaryInterceptor(mockShardLeaderKit.getRef()));
TestShardManager shardManagerInstance = shardManager.underlyingActor();
shardManagerInstance.setMessageInterceptor(newFindPrimaryInterceptor(mockShardLeaderKit.getRef()));
datastoreContextBuilder.shardInitializationTimeout(3, TimeUnit.SECONDS);
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())
MockConfiguration mockConfig = new MockConfiguration(ImmutableMap.<String, List<String>>builder()
.put("shard1", Collections.<String>emptyList()).put("shard2", Collections.<String>emptyList())
@Test
public void testAddShardReplicaForNonExistentShardConfig() throws Exception {
@Test
public void testAddShardReplicaForNonExistentShardConfig() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
ActorRef shardManager = actorFactory
.createActor(newShardMgrProps(new ConfigurationImpl(new EmptyModuleShardConfigProvider()))
{
ActorRef shardManager = actorFactory
.createActor(newShardMgrProps(new ConfigurationImpl(new EmptyModuleShardConfigProvider()))
.withDispatcher(Dispatchers.DefaultDispatcherId()),
shardManagerID);
.withDispatcher(Dispatchers.DefaultDispatcherId()),
shardManagerID);
- new JavaTestKit(system1) {
{
newReplicaShardManager.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
leaderShardManager.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
{
newReplicaShardManager.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
leaderShardManager.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
@Test
public void testAddShardReplicaWithPreExistingReplicaInRemoteShardLeader() throws Exception {
LOG.info("testAddShardReplicaWithPreExistingReplicaInRemoteShardLeader starting");
@Test
public void testAddShardReplicaWithPreExistingReplicaInRemoteShardLeader() throws Exception {
LOG.info("testAddShardReplicaWithPreExistingReplicaInRemoteShardLeader starting");
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
TestActorRef<TestShardManager> shardManager = actorFactory
.createTestActor(newPropsShardMgrWithMockShardActor(), shardMgrID);
{
TestActorRef<TestShardManager> shardManager = actorFactory
.createTestActor(newPropsShardMgrWithMockShardActor(), shardMgrID);
@Test
public void testAddShardReplicaWithPreExistingLocalReplicaLeader() throws Exception {
LOG.info("testAddShardReplicaWithPreExistingLocalReplicaLeader starting");
@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());
{
String memberId = "member-1-shard-default-" + shardMrgIDSuffix;
ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
@Test
public void testAddShardReplicaWithAddServerReplyFailure() throws Exception {
LOG.info("testAddShardReplicaWithAddServerReplyFailure starting");
@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());
MockConfiguration mockConfig = new MockConfiguration(ImmutableMap.<String, List<String>>builder()
.put("astronauts", Arrays.asList("member-2")).build());
shardManager.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
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());
terminateWatcher.watch(mockNewReplicaShardActor);
shardManager.tell(new AddShardReplica("astronauts"), getRef());
public void testAddShardReplicaWithFindPrimaryTimeout() throws Exception {
LOG.info("testAddShardReplicaWithFindPrimaryTimeout starting");
datastoreContextBuilder.shardInitializationTimeout(100, TimeUnit.MILLISECONDS);
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());
{
MockConfiguration mockConfig = new MockConfiguration(ImmutableMap.<String, List<String>>builder()
.put("astronauts", Arrays.asList("member-2")).build());
@Test
public void testRemoveShardReplicaForNonExistentShard() throws Exception {
@Test
public void testRemoveShardReplicaForNonExistentShard() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
ActorRef shardManager = actorFactory
.createActor(newShardMgrProps(new ConfigurationImpl(new EmptyModuleShardConfigProvider()))
{
ActorRef shardManager = actorFactory
.createActor(newShardMgrProps(new ConfigurationImpl(new EmptyModuleShardConfigProvider()))
* Primary is Local.
*/
public void testRemoveShardReplicaLocal() throws Exception {
* Primary is Local.
*/
public void testRemoveShardReplicaLocal() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
String memberId = "member-1-shard-default-" + shardMrgIDSuffix;
{
String memberId = "member-1-shard-default-" + shardMrgIDSuffix;
LOG.error("Forwarding actor : {}", actorRef);
LOG.error("Forwarding actor : {}", actorRef);
- new JavaTestKit(system1) {
{
newReplicaShardManager.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
leaderShardManager.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
{
newReplicaShardManager.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
leaderShardManager.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
public void testServerChangeWhenAlreadyInProgress(final String shardName, final Object firstServerChange,
final Class<?> firstForwardedServerChangeClass,
final Object secondServerChange) throws Exception {
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());
MockConfiguration mockConfig = new MockConfiguration(ImmutableMap.<String, List<String>>builder()
.put(shardName, Arrays.asList("member-2")).build());
@Test
public void testServerRemovedShardActorNotRunning() throws Exception {
LOG.info("testServerRemovedShardActorNotRunning starting");
@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"))
{
MockConfiguration mockConfig = new MockConfiguration(ImmutableMap.<String, List<String>>builder()
.put("default", Arrays.asList("member-1", "member-2"))
@Test
public void testServerRemovedShardActorRunning() throws Exception {
LOG.info("testServerRemovedShardActorRunning starting");
@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"))
{
MockConfiguration mockConfig = new MockConfiguration(ImmutableMap.<String, List<String>>builder()
.put("default", Arrays.asList("member-1", "member-2"))
@Test
public void testShardPersistenceWithRestoredData() throws Exception {
LOG.info("testShardPersistenceWithRestoredData starting");
@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()
{
MockConfiguration mockConfig =
new MockConfiguration(ImmutableMap.<String, List<String>>builder()
@Test
public void testShutDown() throws Exception {
LOG.info("testShutDown starting");
@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());
{
MockConfiguration mockConfig = new MockConfiguration(ImmutableMap.<String, List<String>>builder()
.put("shard1", Arrays.asList("member-1")).put("shard2", Arrays.asList("member-1")).build());
@Test
public void testChangeServersVotingStatus() throws Exception {
@Test
public void testChangeServersVotingStatus() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
String memberId = "member-1-shard-default-" + shardMrgIDSuffix;
{
String memberId = "member-1-shard-default-" + shardMrgIDSuffix;
@Test
public void testChangeServersVotingStatusWithNoLeader() throws Exception {
@Test
public void testChangeServersVotingStatusWithNoLeader() throws Exception {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
String memberId = "member-1-shard-default-" + shardMrgIDSuffix;
{
String memberId = "member-1-shard-default-" + shardMrgIDSuffix;
import akka.actor.UntypedActor;
import akka.dispatch.Futures;
import akka.japi.Creator;
import akka.actor.UntypedActor;
import akka.dispatch.Futures;
import akka.japi.Creator;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestActorRef;
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;
import akka.util.Timeout;
import com.google.common.base.Optional;
import com.google.common.collect.Maps;
@Test
public void testFindLocalShardWithShardFound() {
@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;
+ });
@Test
public void testFindLocalShardWithShardNotFound() {
@Test
public void testFindLocalShardWithShardNotFound() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
ActorRef shardManagerActorRef = getSystem().actorOf(MockShardManager.props(false, null));
{
ActorRef shardManagerActorRef = getSystem().actorOf(MockShardManager.props(false, null));
@Test
public void testExecuteRemoteOperation() {
@Test
public void testExecuteRemoteOperation() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
ActorRef shardActorRef = getSystem().actorOf(Props.create(EchoActor.class));
{
ActorRef shardActorRef = getSystem().actorOf(Props.create(EchoActor.class));
@Test
@SuppressWarnings("checkstyle:IllegalCatch")
public void testExecuteRemoteOperationAsync() {
@Test
@SuppressWarnings("checkstyle:IllegalCatch")
public void testExecuteRemoteOperationAsync() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
ActorRef shardActorRef = getSystem().actorOf(Props.create(EchoActor.class));
{
ActorRef shardActorRef = getSystem().actorOf(Props.create(EchoActor.class));
@Test
public void testSetDatastoreContext() {
@Test
public void testSetDatastoreContext() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
ActorContext actorContext = new ActorContext(getSystem(), getRef(),
mock(ClusterWrapper.class), mock(Configuration.class), DatastoreContext.newBuilder()
{
ActorContext actorContext = new ActorContext(getSystem(), getRef(),
mock(ClusterWrapper.class), mock(Configuration.class), DatastoreContext.newBuilder()
@Test
public void testBroadcast() {
@Test
public void testBroadcast() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
ActorRef shardActorRef1 = getSystem().actorOf(MessageCollectorActor.props());
ActorRef shardActorRef2 = getSystem().actorOf(MessageCollectorActor.props());
{
ActorRef shardActorRef1 = getSystem().actorOf(MessageCollectorActor.props());
ActorRef shardActorRef2 = getSystem().actorOf(MessageCollectorActor.props());
import akka.actor.Address;
import akka.actor.AddressFromURIString;
import akka.cluster.Cluster;
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;
import com.google.common.collect.Lists;
import com.typesafe.config.ConfigFactory;
import java.util.Collections;
followerOperDatastore.close();
}
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();
InMemoryJournal.clear();
InMemorySnapshotStore.clear();
initEmptyDatastores(MODULE_SHARDS_CONFIG);
}
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(
leaderTestKit = new IntegrationTestKit(leaderSystem, leaderDatastoreContextBuilder);
leaderConfigDatastore = leaderTestKit.setupDistributedDataStore(
import akka.actor.AddressFromURIString;
import akka.actor.Props;
import akka.cluster.Cluster;
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;
import com.google.common.base.Optional;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.CheckedFuture;
operDistributedDatastore.close();
}
operDistributedDatastore.close();
}
- JavaTestKit.shutdownActorSystem(leaderSystem);
+ TestKit.shutdownActorSystem(leaderSystem);
InMemoryJournal.clear();
InMemorySnapshotStore.clear();
InMemoryJournal.clear();
InMemorySnapshotStore.clear();
import akka.actor.ActorRef;
import akka.actor.Props;
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;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.AbstractActorTest;
import org.opendaylight.controller.cluster.dom.api.LeaderLocation;
@Test
public void testRegisterRoleChangeListenerOnStart() {
@Test
public void testRegisterRoleChangeListenerOnStart() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final LeaderLocationListener listener = mock(LeaderLocationListener.class);
final Props props = RoleChangeListenerActor.props(getRef(), listener);
{
final LeaderLocationListener listener = mock(LeaderLocationListener.class);
final Props props = RoleChangeListenerActor.props(getRef(), listener);
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
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;
import java.net.URI;
import java.util.Collection;
import org.junit.AfterClass;
static RemoteRpcProviderConfig config2;
protected ActorRef rpcInvoker1;
static RemoteRpcProviderConfig config2;
protected ActorRef rpcInvoker1;
- protected JavaTestKit rpcRegistry1Probe;
+ protected TestKit rpcRegistry1Probe;
protected ActorRef rpcInvoker2;
protected ActorRef rpcInvoker2;
- protected JavaTestKit rpcRegistry2Probe;
+ protected TestKit rpcRegistry2Probe;
protected SchemaContext schemaContext;
protected RemoteRpcImplementation remoteRpcImpl1;
protected RemoteRpcImplementation remoteRpcImpl2;
protected SchemaContext schemaContext;
protected RemoteRpcImplementation remoteRpcImpl1;
protected RemoteRpcImplementation remoteRpcImpl2;
@AfterClass
public static void teardown() {
@AfterClass
public static void teardown() {
- JavaTestKit.shutdownActorSystem(node1);
- JavaTestKit.shutdownActorSystem(node2);
+ TestKit.shutdownActorSystem(node1);
+ TestKit.shutdownActorSystem(node2);
node1 = null;
node2 = null;
}
node1 = null;
node2 = null;
}
MockitoAnnotations.initMocks(this);
MockitoAnnotations.initMocks(this);
- rpcRegistry1Probe = new JavaTestKit(node1);
+ rpcRegistry1Probe = new TestKit(node1);
rpcInvoker1 = node1.actorOf(RpcInvoker.props(domRpcService1));
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);
rpcInvoker2 = node2.actorOf(RpcInvoker.props(domRpcService2));
remoteRpcImpl1 = new RemoteRpcImplementation(rpcInvoker2, config1);
remoteRpcImpl2 = new RemoteRpcImplementation(rpcInvoker1, config2);
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
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;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import java.util.concurrent.TimeUnit;
@AfterClass
public static void teardown() {
@AfterClass
public static void teardown() {
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);
import static org.mockito.Mockito.when;
import akka.actor.Status.Failure;
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;
import com.google.common.util.concurrent.Futures;
import org.junit.Assert;
import org.junit.Test;
@Test
public void testExecuteRpc() {
@Test
public void testExecuteRpc() {
- new JavaTestKit(node1) {
{
final ContainerNode invokeRpcResult = makeRPCOutput("bar");
{
final ContainerNode invokeRpcResult = makeRPCOutput("bar");
@Test
public void testExecuteRpcFailureWithException() {
@Test
public void testExecuteRpcFailureWithException() {
- new JavaTestKit(node1) {
{
when(domRpcService1.invokeRpc(eq(TEST_RPC_TYPE), Mockito.<NormalizedNode<?, ?>>any()))
.thenReturn(Futures.<DOMRpcResult, DOMRpcException>immediateFailedCheckedFuture(
{
when(domRpcService1.invokeRpc(eq(TEST_RPC_TYPE), Mockito.<NormalizedNode<?, ?>>any()))
.thenReturn(Futures.<DOMRpcResult, DOMRpcException>immediateFailedCheckedFuture(
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
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;
import com.typesafe.config.ConfigFactory;
import java.net.URISyntaxException;
import java.util.Collections;
@AfterClass
public static void teardown() {
@AfterClass
public static void teardown() {
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);
system = null;
}
@Test
public void testRouteAdd() throws URISyntaxException, InterruptedException {
system = null;
}
@Test
public void testRouteAdd() throws URISyntaxException, InterruptedException {
- new JavaTestKit(system) {
- final JavaTestKit probeReg = new JavaTestKit(system);
+ final TestKit probeReg = new TestKit(system);
final ActorRef rpcRegistry = probeReg.getRef();
final RpcListener rpcListener = new RpcListener(rpcRegistry);
final ActorRef rpcRegistry = probeReg.getRef();
final RpcListener rpcListener = new RpcListener(rpcRegistry);
@Test
public void testRouteRemove() throws URISyntaxException, InterruptedException {
@Test
public void testRouteRemove() throws URISyntaxException, InterruptedException {
- new JavaTestKit(system) {
- final JavaTestKit probeReg = new JavaTestKit(system);
+ final TestKit probeReg = new TestKit(system);
final ActorRef rpcRegistry = probeReg.getRef();
final RpcListener rpcListener = new RpcListener(rpcRegistry);
final ActorRef rpcRegistry = probeReg.getRef();
final RpcListener rpcListener = new RpcListener(rpcRegistry);
import akka.actor.ActorSystem;
import akka.actor.Address;
import akka.actor.Props;
import akka.actor.ActorSystem;
import akka.actor.Address;
import akka.actor.Props;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestActorRef;
import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
import com.google.common.collect.ImmutableMap;
import java.util.Collections;
import java.util.Map;
import com.google.common.collect.ImmutableMap;
import java.util.Collections;
import java.util.Map;
MockitoAnnotations.initMocks(this);
system = ActorSystem.create("test");
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");
final RemoteRpcProviderConfig config = new RemoteRpcProviderConfig.Builder("system").build();
final Props props = RpcRegistrar.props(config, service);
testActorRef = new TestActorRef<>(system, props, testKit.getRef(), "actorRef");
final DOMRpcIdentifier secondEndpointId = DOMRpcIdentifier.create(
SchemaPath.create(true, QName.create("second:identifier", "bar")));
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));
firstEndpoint = new RemoteRpcEndpoint(senderKit.getRef(), Collections.singletonList(firstEndpointId));
secondEndpoint = new RemoteRpcEndpoint(senderKit.getRef(), Collections.singletonList(secondEndpointId));
@After
public void tearDown() throws Exception {
@After
public void tearDown() throws Exception {
- JavaTestKit.shutdownActorSystem(system, null, Boolean.TRUE);
+ TestKit.shutdownActorSystem(system, true);
Mockito.verifyNoMoreInteractions(service, oldReg, newReg);
}
Mockito.verifyNoMoreInteractions(service, oldReg, newReg);
}
-}
\ No newline at end of file
import akka.cluster.Member;
import akka.cluster.MemberStatus;
import akka.cluster.UniqueAddress;
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;
import com.google.common.base.Stopwatch;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.Uninterruptibles;
private static ActorSystem node2;
private static ActorSystem node3;
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;
private ActorRef registry1;
private ActorRef registry2;
private ActorRef registry3;
@AfterClass
public static void staticTeardown() {
@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() {
}
@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()));
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()));
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()));
}
registry3 = node3.actorOf(RpcRegistry.props(config(node3), invoker3.getRef(), registrar3.getRef()));
}
registry1.tell(new AddOrUpdateRoutes(addedRouteIds), ActorRef.noSender());
// Bucket store should get an update bucket message. Updated bucket contains added rpc.
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);
Map<Address, Bucket<RoutingTable>> buckets = retrieveBuckets(registry1, testKit, nodeAddress);
verifyBucket(buckets.get(nodeAddress), addedRouteIds);
registry1.tell(new AddOrUpdateRoutes(addedRouteIds), ActorRef.noSender());
// Bucket store on node2 should get a message to update its local copy of remote buckets
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);
Map<Address, Bucket<RoutingTable>> buckets = retrieveBuckets(registry2, testKit, node1Address);
verifyBucket(buckets.get(node1Address), addedRouteIds);
LOG.info("testRpcAddRemoveInCluster ending");
}
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;
throws AssertionError {
Map<Address, Bucket<RoutingTable>> buckets;
int numTries = 0;
*/
@Test
public void testRpcAddedOnMultiNodes() throws Exception {
*/
@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();
// Add rpc on node 1
List<DOMRpcIdentifier> addedRouteIds1 = createRouteIds();
- 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());
final Map<Address, Optional<RemoteRpcEndpoint>> endpoints = msg.getEndpoints();
Assert.assertEquals(1, endpoints.size());
Assert.assertEquals("hello", s);
}
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);
bucketStore.tell(GET_BUCKET_VERSIONS, testKit.getRef());
@SuppressWarnings("unchecked")
final Map<Address, Long> reply = testKit.expectMsgClass(Duration.create(3, TimeUnit.SECONDS), Map.class);
}
private static Map<Address, Bucket<RoutingTable>> retrieveBuckets(final ActorRef bucketStore,
}
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());
int numTries = 0;
while (true) {
bucketStore.tell(GET_ALL_BUCKETS, testKit.getRef());
@Test
public void testAddRoutesConcurrency() {
@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);
final int nRoutes = 500;
final Collection<DOMRpcIdentifier> added = new ArrayList<>(nRoutes);
import akka.actor.ActorSystem;
import akka.actor.Address;
import akka.actor.Props;
import akka.actor.ActorSystem;
import akka.actor.Address;
import akka.actor.Props;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestActorRef;
import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
import com.google.common.collect.ImmutableMap;
import com.typesafe.config.ConfigFactory;
import java.util.HashMap;
import com.google.common.collect.ImmutableMap;
import com.typesafe.config.ConfigFactory;
import java.util.HashMap;
@AfterClass
public static void teardown() {
@AfterClass
public static void teardown() {
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);
import akka.actor.ActorSystem;
import akka.actor.Address;
import akka.actor.Props;
import akka.actor.ActorSystem;
import akka.actor.Address;
import akka.actor.Props;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestActorRef;
import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
import com.typesafe.config.ConfigFactory;
import java.util.Map;
import org.junit.After;
import com.typesafe.config.ConfigFactory;
import java.util.Map;
import org.junit.After;
@AfterClass
public static void teardown() {
@AfterClass
public static void teardown() {
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestActorRef;
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;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.Uninterruptibles;
import java.util.Collections;
buckets = Lists.newArrayList(emptyRpcIdentifier, localRpcIdentifier);
final RemoteRpcProviderConfig config = new RemoteRpcProviderConfig.Builder("system").build();
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();
final Props props = RpcRegistry.props(config, invoker.getRef(), registrar.getRef());
testActor = new TestActorRef<>(system, props, supervisor.getRef(), "testActor");
final RpcRegistry rpcRegistry = testActor.underlyingActor();
@After
public void tearDown() throws Exception {
@After
public void tearDown() throws Exception {
- JavaTestKit.shutdownActorSystem(system, null, Boolean.TRUE);
+ TestKit.shutdownActorSystem(system, Boolean.TRUE);
Assert.assertTrue(bucketVersions.contains(testActor.provider().getDefaultAddress().toString()));
}
Assert.assertTrue(bucketVersions.contains(testActor.provider().getDefaultAddress().toString()));
}
-}
\ No newline at end of file
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.japi.Pair;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.japi.Pair;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestProbe;
import akka.testkit.TestProbe;
+import akka.testkit.javadsl.TestKit;
import com.typesafe.config.ConfigFactory;
import java.util.ArrayList;
import java.util.List;
import com.typesafe.config.ConfigFactory;
import java.util.ArrayList;
import java.util.List;
@AfterClass
public static void teardown() {
@AfterClass
public static void teardown() {
- JavaTestKit.shutdownActorSystem(system);
+ TestKit.shutdownActorSystem(system);