X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-remoterpc-connector%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fremote%2Frpc%2Futils%2FLatestEntryRoutingLogicTest.java;fp=opendaylight%2Fmd-sal%2Fsal-remoterpc-connector%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fremote%2Frpc%2Futils%2FLatestEntryRoutingLogicTest.java;h=0b94b546eb004a3ff527fc002597d5ad0bbd5621;hp=a618bff6a3600c6c2544e6c36de24f8a7063dd69;hb=9ddc65e1ddae50f691566cd9382707679436c055;hpb=b664876e74191b7ec06650e2a396605025ffb48a diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/utils/LatestEntryRoutingLogicTest.java b/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/utils/LatestEntryRoutingLogicTest.java index a618bff6a3..0b94b546eb 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/utils/LatestEntryRoutingLogicTest.java +++ b/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/utils/LatestEntryRoutingLogicTest.java @@ -9,47 +9,46 @@ package org.opendaylight.controller.remote.rpc.utils; import static org.junit.Assert.assertTrue; + import akka.actor.ActorRef; import akka.actor.ActorSystem; import akka.japi.Pair; import akka.testkit.JavaTestKit; import akka.testkit.TestProbe; import com.typesafe.config.ConfigFactory; +import java.util.ArrayList; +import java.util.List; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; -import java.util.ArrayList; -import java.util.List; - public class LatestEntryRoutingLogicTest { - - static ActorSystem system; - - @BeforeClass - public static void setup() throws InterruptedException { - system = ActorSystem.create("opendaylight-rpc", ConfigFactory.load().getConfig("odl-cluster-rpc")); - } - - @AfterClass - public static void teardown() { - JavaTestKit.shutdownActorSystem(system); - system = null; - } - - @Test - public void testRoutingLogic() { - List> pairList = new ArrayList<>(); - TestProbe probe1 = new TestProbe(system); - TestProbe probe2 = new TestProbe(system); - TestProbe probe3 = new TestProbe(system); - ActorRef actor1 = probe1.ref(); - ActorRef actor2 = probe2.ref(); - ActorRef actor3 = probe3.ref(); - pairList.add(new Pair<>(actor1, 1000L)); - pairList.add(new Pair<>(actor2, 3000L)); - pairList.add(new Pair<>(actor3, 2000L)); - RoutingLogic logic = new LatestEntryRoutingLogic(pairList); - assertTrue(logic.select().equals(actor2)); - } + static ActorSystem system; + + @BeforeClass + public static void setup() throws InterruptedException { + system = ActorSystem.create("opendaylight-rpc", ConfigFactory.load().getConfig("odl-cluster-rpc")); + } + + @AfterClass + public static void teardown() { + JavaTestKit.shutdownActorSystem(system); + system = null; + } + + @Test + public void testRoutingLogic() { + List> pairList = new ArrayList<>(); + TestProbe probe1 = new TestProbe(system); + TestProbe probe2 = new TestProbe(system); + TestProbe probe3 = new TestProbe(system); + ActorRef actor1 = probe1.ref(); + ActorRef actor2 = probe2.ref(); + ActorRef actor3 = probe3.ref(); + pairList.add(new Pair<>(actor1, 1000L)); + pairList.add(new Pair<>(actor2, 3000L)); + pairList.add(new Pair<>(actor3, 2000L)); + RoutingLogic logic = new LatestEntryRoutingLogic(pairList); + assertTrue(logic.select().equals(actor2)); + } }