Search in sources :

Example 16 with ModifyTransactionRequestBuilder

use of org.opendaylight.controller.cluster.access.commands.ModifyTransactionRequestBuilder 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 17 with ModifyTransactionRequestBuilder

use of org.opendaylight.controller.cluster.access.commands.ModifyTransactionRequestBuilder in project controller by opendaylight.

the class FrontendReadWriteTransactionTest method testReadAfterAbort.

@Test(expected = IllegalStateException.class)
public void testReadAfterAbort() throws RequestException {
    final ModifyTransactionRequestBuilder b = new ModifyTransactionRequestBuilder(TX_ID, mock(ActorRef.class));
    b.setSequence(0);
    b.setAbort();
    final TransactionRequest<?> abortReq = b.build();
    assertNull(handleRequest(abortReq));
    verify(mockParent).abortTransaction(same(shardTransaction), any(Runnable.class));
    handleRequest(new ReadTransactionRequest(TX_ID, 0, mock(ActorRef.class), YangInstanceIdentifier.EMPTY, true));
}
Also used : ModifyTransactionRequestBuilder(org.opendaylight.controller.cluster.access.commands.ModifyTransactionRequestBuilder) ActorRef(akka.actor.ActorRef) ReadTransactionRequest(org.opendaylight.controller.cluster.access.commands.ReadTransactionRequest) Test(org.junit.Test)

Example 18 with ModifyTransactionRequestBuilder

use of org.opendaylight.controller.cluster.access.commands.ModifyTransactionRequestBuilder in project controller by opendaylight.

the class FrontendReadWriteTransactionTest method testDuplicateReady.

@Test
public void testDuplicateReady() throws RequestException {
    final ModifyTransactionRequestBuilder b = new ModifyTransactionRequestBuilder(TX_ID, mock(ActorRef.class));
    b.setSequence(0);
    b.setReady();
    final TransactionRequest<?> readyReq = b.build();
    assertNotNull(handleRequest(readyReq));
    verify(mockParent).finishTransaction(same(shardTransaction));
    assertNotNull(handleRequest(readyReq));
    verifyNoMoreInteractions(mockParent);
}
Also used : ModifyTransactionRequestBuilder(org.opendaylight.controller.cluster.access.commands.ModifyTransactionRequestBuilder) ActorRef(akka.actor.ActorRef) Test(org.junit.Test)

Example 19 with ModifyTransactionRequestBuilder

use of org.opendaylight.controller.cluster.access.commands.ModifyTransactionRequestBuilder in project controller by opendaylight.

the class FrontendReadWriteTransactionTest method testDuplicateDirect.

@Test
public void testDuplicateDirect() throws RequestException {
    final ModifyTransactionRequestBuilder b = new ModifyTransactionRequestBuilder(TX_ID, mock(ActorRef.class));
    b.setSequence(0);
    b.setCommit(false);
    final TransactionRequest<?> readyReq = b.build();
    assertNull(handleRequest(readyReq));
    verify(mockParent).finishTransaction(same(shardTransaction));
    assertNull(handleRequest(readyReq));
    verifyNoMoreInteractions(mockParent);
}
Also used : ModifyTransactionRequestBuilder(org.opendaylight.controller.cluster.access.commands.ModifyTransactionRequestBuilder) ActorRef(akka.actor.ActorRef) Test(org.junit.Test)

Aggregations

ModifyTransactionRequestBuilder (org.opendaylight.controller.cluster.access.commands.ModifyTransactionRequestBuilder)19 Test (org.junit.Test)17 ActorRef (akka.actor.ActorRef)7 TestProbe (akka.testkit.TestProbe)7 ModifyTransactionRequest (org.opendaylight.controller.cluster.access.commands.ModifyTransactionRequest)7 Response (org.opendaylight.controller.cluster.access.concepts.Response)5 TransactionWrite (org.opendaylight.controller.cluster.access.commands.TransactionWrite)3 ReadTransactionRequest (org.opendaylight.controller.cluster.access.commands.ReadTransactionRequest)2 TransactionDelete (org.opendaylight.controller.cluster.access.commands.TransactionDelete)2 TransactionMerge (org.opendaylight.controller.cluster.access.commands.TransactionMerge)2 TransactionModification (org.opendaylight.controller.cluster.access.commands.TransactionModification)2 TransactionPurgeRequest (org.opendaylight.controller.cluster.access.commands.TransactionPurgeRequest)2 TransactionPurgeResponse (org.opendaylight.controller.cluster.access.commands.TransactionPurgeResponse)2 RequestEnvelope (org.opendaylight.controller.cluster.access.concepts.RequestEnvelope)2 RequestException (org.opendaylight.controller.cluster.access.concepts.RequestException)2 SliceOptions (org.opendaylight.controller.cluster.messaging.SliceOptions)2 CommitLocalTransactionRequest (org.opendaylight.controller.cluster.access.commands.CommitLocalTransactionRequest)1 FailureEnvelope (org.opendaylight.controller.cluster.access.concepts.FailureEnvelope)1 LocalHistoryIdentifier (org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier)1 TransactionIdentifier (org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier)1