use of org.opendaylight.controller.cluster.access.commands.ModifyTransactionRequestBuilder in project controller by opendaylight.
the class LocalReadOnlyProxyTransactionTest method testApplyModifyTransactionRequest.
@Test
public void testApplyModifyTransactionRequest() throws Exception {
final TestProbe probe = createProbe();
final ModifyTransactionRequestBuilder builder = new ModifyTransactionRequestBuilder(TRANSACTION_ID, probe.ref());
builder.setSequence(0);
builder.setAbort();
final ModifyTransactionRequest request = builder.build();
transaction.replayModifyTransactionRequest(request, createCallbackMock(), Ticker.systemTicker().read());
getTester().expectTransactionRequest(AbortLocalTransactionRequest.class);
}
use of org.opendaylight.controller.cluster.access.commands.ModifyTransactionRequestBuilder in project controller by opendaylight.
the class LocalReadOnlyProxyTransactionTest method testApplyModifyTransactionRequestNotAbort.
@Test
public void testApplyModifyTransactionRequestNotAbort() throws Exception {
final TestProbe probe = createProbe();
final ModifyTransactionRequestBuilder builder = new ModifyTransactionRequestBuilder(TRANSACTION_ID, probe.ref());
builder.setSequence(0);
builder.setReady();
final ModifyTransactionRequest request = builder.build();
assertOperationThrowsException(() -> transaction.replayModifyTransactionRequest(request, createCallbackMock(), Ticker.systemTicker().read()), VerifyException.class);
}
use of org.opendaylight.controller.cluster.access.commands.ModifyTransactionRequestBuilder in project controller by opendaylight.
the class RemoteProxyTransactionTest method testForwardToRemoteModifyAbort.
@Test
public void testForwardToRemoteModifyAbort() throws Exception {
final TestProbe probe = createProbe();
final ModifyTransactionRequestBuilder builder = new ModifyTransactionRequestBuilder(TRANSACTION_ID, probe.ref());
builder.setSequence(0L);
builder.setAbort();
final ModifyTransactionRequest request = builder.build();
final ModifyTransactionRequest received = testForwardToRemote(request, ModifyTransactionRequest.class);
Assert.assertEquals(request.getTarget(), received.getTarget());
Assert.assertTrue(received.getPersistenceProtocol().isPresent());
Assert.assertEquals(PersistenceProtocol.ABORT, received.getPersistenceProtocol().get());
}
use of org.opendaylight.controller.cluster.access.commands.ModifyTransactionRequestBuilder in project controller by opendaylight.
the class FrontendReadWriteTransactionTest method testModifyAfterReady.
@Test(expected = IllegalStateException.class)
public void testModifyAfterReady() 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));
b.setSequence(1);
b.addModification(mock(TransactionModification.class));
handleRequest(b.build());
}
use of org.opendaylight.controller.cluster.access.commands.ModifyTransactionRequestBuilder in project controller by opendaylight.
the class FrontendReadWriteTransactionTest method testReadAfterReady.
@Test(expected = IllegalStateException.class)
public void testReadAfterReady() 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));
handleRequest(new ReadTransactionRequest(TX_ID, 0, mock(ActorRef.class), YangInstanceIdentifier.EMPTY, true));
}
Aggregations