use of org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier in project controller by opendaylight.
the class DataTreeCohortActorTest method testAbortAfterPreCommit.
@Test
public void testAbortAfterPreCommit() throws Exception {
ActorRef cohortActor = newCohortActor("testAbortAfterPreCommit");
TransactionIdentifier txId = nextTransactionId();
askAndAwait(cohortActor, new CanCommit(txId, CANDIDATES, MOCK_SCHEMA, cohortActor));
verify(mockCohort).canCommit(txId, CANDIDATES, MOCK_SCHEMA);
askAndAwait(cohortActor, new PreCommit(txId));
verify(mockPostCanCommit).preCommit();
askAndAwait(cohortActor, new Abort(txId));
verify(mockPostPreCommit).abort();
}
use of org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier in project controller by opendaylight.
the class AbstractShardTest method setupCohortDecorator.
protected Map<TransactionIdentifier, CapturingShardDataTreeCohort> setupCohortDecorator(final Shard shard, final TransactionIdentifier... transactionIDs) {
final Map<TransactionIdentifier, CapturingShardDataTreeCohort> cohortMap = new HashMap<>();
for (TransactionIdentifier id : transactionIDs) {
cohortMap.put(id, new CapturingShardDataTreeCohort());
}
shard.getCommitCoordinator().setCohortDecorator((transactionID, actual) -> {
CapturingShardDataTreeCohort cohort = cohortMap.get(transactionID);
cohort.setDelegate(actual);
return cohort;
});
return cohortMap;
}
Aggregations