X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-clustering-commons%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fcommon%2Factor%2FMeteredBoundedMailboxTest.java;h=673b4b1876f0eeb2ec718634793bb0cfba1674bb;hp=7f91c1bc8573dbfc27fa701dea5c5314921ce693;hb=HEAD;hpb=2d60632f7cf63712e8357a3cf3fc40d83366e5e6 diff --git a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/common/actor/MeteredBoundedMailboxTest.java b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/common/actor/MeteredBoundedMailboxTest.java index 7f91c1bc85..673b4b1876 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/common/actor/MeteredBoundedMailboxTest.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/common/actor/MeteredBoundedMailboxTest.java @@ -11,8 +11,8 @@ import akka.actor.ActorRef; import akka.actor.ActorSystem; import akka.actor.DeadLetter; import akka.actor.Props; -import akka.actor.UntypedActor; -import akka.testkit.JavaTestKit; +import akka.actor.UntypedAbstractActor; +import akka.testkit.TestKit; import com.typesafe.config.ConfigFactory; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.ReentrantLock; @@ -28,13 +28,13 @@ public class MeteredBoundedMailboxTest { private final ReentrantLock lock = new ReentrantLock(); @BeforeClass - public static void setUp() throws Exception { + public static void setUp() { config = new CommonConfig.Builder<>("testsystem").withConfigReader(ConfigFactory::load).build(); actorSystem = ActorSystem.create("testsystem", config.get()); } @AfterClass - public static void tearDown() throws Exception { + public static void tearDown() { if (actorSystem != null) { actorSystem.terminate(); actorSystem = null; @@ -42,9 +42,9 @@ public class MeteredBoundedMailboxTest { } @Test - public void shouldSendMsgToDeadLetterWhenQueueIsFull() throws InterruptedException { - final JavaTestKit mockReceiver = new JavaTestKit(actorSystem); - actorSystem.eventStream().subscribe(mockReceiver.getRef(), DeadLetter.class); + public void shouldSendMsgToDeadLetterWhenQueueIsFull() { + final TestKit mockReceiver = new TestKit(actorSystem); + actorSystem.eventStream().subscribe(mockReceiver.testActor(), DeadLetter.class); final FiniteDuration twentySeconds = new FiniteDuration(20, TimeUnit.SECONDS); @@ -59,7 +59,7 @@ public class MeteredBoundedMailboxTest { //2nd to 11th messages are put on the queue //12th message is sent to dead letter. for (int i = 0; i < 12; i++) { - pingPongActor.tell("ping", mockReceiver.getRef()); + pingPongActor.tell("ping", mockReceiver.testActor()); } mockReceiver.expectMsgClass(twentySeconds, DeadLetter.class); @@ -73,7 +73,7 @@ public class MeteredBoundedMailboxTest { /** * For testing. */ - public static class PingPongActor extends UntypedActor { + public static class PingPongActor extends UntypedAbstractActor { ReentrantLock lock; @@ -86,7 +86,7 @@ public class MeteredBoundedMailboxTest { } @Override - public void onReceive(final Object message) throws Exception { + public void onReceive(final Object message) { lock.lock(); try { if ("ping".equals(message)) {