* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
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.PoisonPill;
import akka.actor.Props;
import akka.pattern.Patterns;
-import akka.testkit.JavaTestKit;
import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
import akka.util.Timeout;
import com.google.common.base.Stopwatch;
import com.google.common.util.concurrent.Uninterruptibles;
ActorSelection actorSelection = system.actorSelection(actorRef.path().toString());
Future<Object> future = Patterns.ask(actorSelection, new Identify(""), timeout);
ActorIdentity reply = (ActorIdentity)Await.result(future, timeout.duration());
- Assert.assertNotNull("Identify returned null", reply.getRef());
+ Assert.assertTrue("Identify returned non-present", reply.getActorRef().isPresent());
return;
} catch (Exception | AssertionError e) {
Uninterruptibles.sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
return prefix + actorCount++;
}
- public void killActor(ActorRef actor, JavaTestKit kit) {
+ public void killActor(ActorRef actor, TestKit kit) {
killActor(actor, kit, true);
}
- private void killActor(ActorRef actor, JavaTestKit kit, boolean remove) {
+ private void killActor(ActorRef actor, TestKit kit, boolean remove) {
LOG.info("Killing actor {}", actor);
kit.watch(actor);
actor.tell(PoisonPill.getInstance(), ActorRef.noSender());
- kit.expectTerminated(JavaTestKit.duration("5 seconds"), actor);
+ kit.expectTerminated(kit.duration("5 seconds"), actor);
if (remove) {
createdActors.remove(actor);
@Override
public void close() {
- JavaTestKit kit = new JavaTestKit(system);
+ TestKit kit = new TestKit(system);
for (ActorRef actor : createdActors) {
killActor(actor, kit, false);
}