use of org.opendaylight.controller.cluster.access.commands.TransactionCommitSuccess in project controller by opendaylight.
the class FrontendReadWriteTransaction method successfulCommit.
void successfulCommit(final RequestEnvelope envelope, final long startTime) {
if (state instanceof Retired) {
LOG.debug("{}: Suppressing commit response on retired transaction {}", persistenceId(), getIdentifier());
return;
}
recordAndSendSuccess(envelope, startTime, new TransactionCommitSuccess(getIdentifier(), envelope.getMessage().getSequence()));
state = COMMITTED;
}
use of org.opendaylight.controller.cluster.access.commands.TransactionCommitSuccess in project controller by opendaylight.
the class ClientTransactionTest method testReady.
@Test
public void testReady() throws Exception {
getHandle().write(PATH, DATA);
final DOMStoreThreePhaseCommitCohort cohort = getHandle().ready();
final TransactionCommitSuccess response = new TransactionCommitSuccess(TRANSACTION_ID, 0L);
final ListenableFuture<Boolean> actual = cohort.canCommit();
final CommitLocalTransactionRequest request = backendRespondToRequest(CommitLocalTransactionRequest.class, response);
Assert.assertEquals(modification, request.getModification());
assertFutureEquals(true, actual);
assertFutureEquals(null, cohort.preCommit());
assertFutureEquals(null, cohort.commit());
}
use of org.opendaylight.controller.cluster.access.commands.TransactionCommitSuccess in project controller by opendaylight.
the class DirectTransactionCommitCohortTest method testCanCommit.
@Test
public void testCanCommit() throws Exception {
final ListenableFuture<Boolean> canCommit = cohort.canCommit();
final ModifyTransactionRequest request = transaction.expectTransactionRequest(ModifyTransactionRequest.class);
Assert.assertTrue(request.getPersistenceProtocol().isPresent());
Assert.assertEquals(PersistenceProtocol.SIMPLE, request.getPersistenceProtocol().get());
final RequestSuccess<?, ?> success = new TransactionCommitSuccess(transaction.getTransaction().getIdentifier(), transaction.getLastReceivedMessage().getSequence());
transaction.replySuccess(success);
Assert.assertTrue(getWithTimeout(canCommit));
}
use of org.opendaylight.controller.cluster.access.commands.TransactionCommitSuccess in project controller by opendaylight.
the class LocalReadWriteProxyTransactionTest method testDirectCommit.
@Test
@Override
public void testDirectCommit() throws Exception {
transaction.seal();
final ListenableFuture<Boolean> result = transaction.directCommit();
final TransactionTester<LocalReadWriteProxyTransaction> tester = getTester();
final CommitLocalTransactionRequest req = tester.expectTransactionRequest(CommitLocalTransactionRequest.class);
tester.replySuccess(new TransactionCommitSuccess(TRANSACTION_ID, req.getSequence()));
assertFutureEquals(true, result);
}
use of org.opendaylight.controller.cluster.access.commands.TransactionCommitSuccess in project controller by opendaylight.
the class RemoteProxyTransactionTest method testDirectCommit.
@Override
@Test
public void testDirectCommit() throws Exception {
transaction.seal();
final ListenableFuture<Boolean> result = transaction.directCommit();
final TransactionTester<RemoteProxyTransaction> tester = getTester();
final ModifyTransactionRequest req = tester.expectTransactionRequest(ModifyTransactionRequest.class);
Assert.assertTrue(req.getPersistenceProtocol().isPresent());
Assert.assertEquals(PersistenceProtocol.SIMPLE, req.getPersistenceProtocol().get());
tester.replySuccess(new TransactionCommitSuccess(TRANSACTION_ID, req.getSequence()));
assertFutureEquals(true, result);
}
Aggregations