Search in sources :

Example 51 with TestProbe

use of akka.testkit.TestProbe in project controller by opendaylight.

the class LatestEntryRoutingLogicTest method testRoutingLogic.

@Test
public void testRoutingLogic() {
    List<Pair<ActorRef, Long>> 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));
}
Also used : ActorRef(akka.actor.ActorRef) ArrayList(java.util.ArrayList) TestProbe(akka.testkit.TestProbe) Pair(akka.japi.Pair) Test(org.junit.Test)

Aggregations

TestProbe (akka.testkit.TestProbe)51 Test (org.junit.Test)30 Before (org.junit.Before)13 ModifyTransactionRequest (org.opendaylight.controller.cluster.access.commands.ModifyTransactionRequest)10 ClientActorContext (org.opendaylight.controller.cluster.access.client.ClientActorContext)8 ModifyTransactionRequestBuilder (org.opendaylight.controller.cluster.access.commands.ModifyTransactionRequestBuilder)7 Response (org.opendaylight.controller.cluster.access.concepts.Response)5 ActorContext (org.opendaylight.controller.cluster.datastore.utils.ActorContext)5 AbortLocalTransactionRequest (org.opendaylight.controller.cluster.access.commands.AbortLocalTransactionRequest)4 ConnectClientSuccess (org.opendaylight.controller.cluster.access.commands.ConnectClientSuccess)4 TransactionPurgeRequest (org.opendaylight.controller.cluster.access.commands.TransactionPurgeRequest)4 CursorAwareDataTreeModification (org.opendaylight.yangtools.yang.data.api.schema.tree.CursorAwareDataTreeModification)4 CommitLocalTransactionRequest (org.opendaylight.controller.cluster.access.commands.CommitLocalTransactionRequest)3 ExistsTransactionRequest (org.opendaylight.controller.cluster.access.commands.ExistsTransactionRequest)3 ReadTransactionRequest (org.opendaylight.controller.cluster.access.commands.ReadTransactionRequest)3 TransactionAbortRequest (org.opendaylight.controller.cluster.access.commands.TransactionAbortRequest)3 ActorRef (akka.actor.ActorRef)2 ArrayList (java.util.ArrayList)2 TransactionDoCommitRequest (org.opendaylight.controller.cluster.access.commands.TransactionDoCommitRequest)2 TransactionPreCommitRequest (org.opendaylight.controller.cluster.access.commands.TransactionPreCommitRequest)2