Search in sources :

Example 46 with TestProbe

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

the class RemoteProxyTransactionTest method testForwardToRemoteModifyExists.

@Test
public void testForwardToRemoteModifyExists() throws Exception {
    final TestProbe probe = createProbe();
    final ExistsTransactionRequest request = new ExistsTransactionRequest(TRANSACTION_ID, 0L, probe.ref(), PATH_1, false);
    final ExistsTransactionRequest received = testForwardToRemote(request, ExistsTransactionRequest.class);
    Assert.assertEquals(request.getTarget(), received.getTarget());
    Assert.assertEquals(request.getPath(), received.getPath());
}
Also used : ExistsTransactionRequest(org.opendaylight.controller.cluster.access.commands.ExistsTransactionRequest) TestProbe(akka.testkit.TestProbe) Test(org.junit.Test)

Example 47 with TestProbe

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

the class RemoteProxyTransactionTest method testForwardToRemoteModifyCommitSimple.

@Test
public void testForwardToRemoteModifyCommitSimple() throws Exception {
    final TestProbe probe = createProbe();
    final ModifyTransactionRequestBuilder builder = new ModifyTransactionRequestBuilder(TRANSACTION_ID, probe.ref());
    builder.setSequence(0L);
    builder.setCommit(false);
    final ModifyTransactionRequest request = builder.build();
    final ModifyTransactionRequest received = testForwardToRemote(request, ModifyTransactionRequest.class);
    Assert.assertEquals(request.getPersistenceProtocol(), received.getPersistenceProtocol());
    Assert.assertEquals(request.getModifications(), received.getModifications());
    Assert.assertEquals(request.getTarget(), received.getTarget());
}
Also used : ModifyTransactionRequestBuilder(org.opendaylight.controller.cluster.access.commands.ModifyTransactionRequestBuilder) TestProbe(akka.testkit.TestProbe) ModifyTransactionRequest(org.opendaylight.controller.cluster.access.commands.ModifyTransactionRequest) Test(org.junit.Test)

Example 48 with TestProbe

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

the class RemoteProxyTransactionTest method testForwardToRemoteModifyCommit3Phase.

@Test
public void testForwardToRemoteModifyCommit3Phase() throws Exception {
    final TestProbe probe = createProbe();
    final ModifyTransactionRequestBuilder builder = new ModifyTransactionRequestBuilder(TRANSACTION_ID, probe.ref());
    builder.setSequence(0L);
    builder.setCommit(true);
    final ModifyTransactionRequest request = builder.build();
    final ModifyTransactionRequest received = testForwardToRemote(request, ModifyTransactionRequest.class);
    Assert.assertEquals(request.getPersistenceProtocol(), received.getPersistenceProtocol());
    Assert.assertEquals(request.getModifications(), received.getModifications());
    Assert.assertEquals(request.getTarget(), received.getTarget());
}
Also used : ModifyTransactionRequestBuilder(org.opendaylight.controller.cluster.access.commands.ModifyTransactionRequestBuilder) TestProbe(akka.testkit.TestProbe) ModifyTransactionRequest(org.opendaylight.controller.cluster.access.commands.ModifyTransactionRequest) Test(org.junit.Test)

Example 49 with TestProbe

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

the class RoleChangeNotifierTest method setUp.

@Before
public void setUp() throws Exception {
    system = ActorSystem.apply();
    notifier = system.actorOf(RoleChangeNotifier.getProps(MEMBER_ID));
    listeners = new ArrayList<>(LISTENER_COUNT);
    for (int i = 0; i < LISTENER_COUNT; i++) {
        listeners.add(new TestProbe(system));
    }
}
Also used : TestProbe(akka.testkit.TestProbe) Before(org.junit.Before)

Example 50 with TestProbe

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

the class RoleChangeNotifierTest method checkListenerLeaderStateChanged.

private void checkListenerLeaderStateChanged(final LeaderStateChanged leaderStateChanged) {
    for (final TestProbe listener : listeners) {
        final LeaderStateChanged received = listener.expectMsgClass(LeaderStateChanged.class);
        Assert.assertEquals(leaderStateChanged.getMemberId(), received.getMemberId());
        Assert.assertEquals(leaderStateChanged.getLeaderId(), received.getLeaderId());
        Assert.assertEquals(leaderStateChanged.getLeaderPayloadVersion(), received.getLeaderPayloadVersion());
    }
}
Also used : TestProbe(akka.testkit.TestProbe)

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