Search in sources :

Example 36 with TestProbe

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

the class LocalProxyTransactionTest method testForwardToLocalAbort.

@Test
public void testForwardToLocalAbort() throws Exception {
    final TestProbe probe = createProbe();
    final AbortLocalTransactionRequest request = new AbortLocalTransactionRequest(TRANSACTION_ID, probe.ref());
    testForwardToLocal(request, AbortLocalTransactionRequest.class);
}
Also used : AbortLocalTransactionRequest(org.opendaylight.controller.cluster.access.commands.AbortLocalTransactionRequest) TestProbe(akka.testkit.TestProbe) Test(org.junit.Test)

Example 37 with TestProbe

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

the class LocalProxyTransactionTest method testHandleForwardedRemoteExistsRequest.

@Test
public void testHandleForwardedRemoteExistsRequest() throws Exception {
    final TestProbe probe = createProbe();
    final ExistsTransactionRequest request = new ExistsTransactionRequest(TRANSACTION_ID, 0L, probe.ref(), PATH_1, true);
    final Consumer<Response<?, ?>> callback = createCallbackMock();
    setupExecuteInActor();
    transaction.handleReplayedRemoteRequest(request, callback, Ticker.systemTicker().read());
    final ArgumentCaptor<Response> captor = ArgumentCaptor.forClass(Response.class);
    verify(callback).accept(captor.capture());
    final Response<?, ?> value = captor.getValue();
    Assert.assertTrue(value instanceof ExistsTransactionSuccess);
    final ExistsTransactionSuccess success = (ExistsTransactionSuccess) value;
    Assert.assertTrue(success.getExists());
}
Also used : Response(org.opendaylight.controller.cluster.access.concepts.Response) ExistsTransactionRequest(org.opendaylight.controller.cluster.access.commands.ExistsTransactionRequest) TestProbe(akka.testkit.TestProbe) ExistsTransactionSuccess(org.opendaylight.controller.cluster.access.commands.ExistsTransactionSuccess) Test(org.junit.Test)

Example 38 with TestProbe

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

the class LocalProxyTransactionTest method testHandleForwardedRemotePurgeRequest.

@Test
public void testHandleForwardedRemotePurgeRequest() throws Exception {
    final TestProbe probe = createProbe();
    final TransactionPurgeRequest request = new TransactionPurgeRequest(TRANSACTION_ID, 0L, probe.ref());
    testHandleForwardedRemoteRequest(request);
}
Also used : TransactionPurgeRequest(org.opendaylight.controller.cluster.access.commands.TransactionPurgeRequest) TestProbe(akka.testkit.TestProbe) Test(org.junit.Test)

Example 39 with TestProbe

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

the class LocalReadWriteProxyTransactionTest method testSendAbort.

@Test
public void testSendAbort() throws Exception {
    final TestProbe probe = createProbe();
    final TransactionRequest<?> request = new AbortLocalTransactionRequest(TRANSACTION_ID, probe.ref());
    transaction.sendAbort(request, createCallbackMock());
    assertOperationThrowsException(() -> transaction.delete(PATH_1), IllegalStateException.class);
}
Also used : AbortLocalTransactionRequest(org.opendaylight.controller.cluster.access.commands.AbortLocalTransactionRequest) TestProbe(akka.testkit.TestProbe) Test(org.junit.Test)

Example 40 with TestProbe

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

the class LocalReadWriteProxyTransactionTest method testForwardToLocalCommit.

@Test
public void testForwardToLocalCommit() throws Exception {
    final TestProbe probe = createProbe();
    final DataTreeModification mod = mock(DataTreeModification.class);
    final TransactionRequest<?> request = new CommitLocalTransactionRequest(TRANSACTION_ID, 0L, probe.ref(), mod, null, false);
    testForwardToLocal(request, CommitLocalTransactionRequest.class);
}
Also used : DataTreeModification(org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification) CursorAwareDataTreeModification(org.opendaylight.yangtools.yang.data.api.schema.tree.CursorAwareDataTreeModification) TestProbe(akka.testkit.TestProbe) CommitLocalTransactionRequest(org.opendaylight.controller.cluster.access.commands.CommitLocalTransactionRequest) 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