ThreePhaseCommitCohortProxy extends AbstractThreePhaseCommitCohort<ActorSelection> { @Override public ListenableFuture<Void> abort() { return voidOperation("abort", ABORT_MESSAGE_SUPPLIER, AbortTransactionReply.class, false, OperationCallback.NO_OP_CALLBACK); } ThreePhaseCommitCohortProxy(final ActorUtils actorUtils, final List<CohortInfo> cohorts,
            final TransactionIdentifier transactionId); @Override ListenableFuture<Boolean> canCommit(); @Override ListenableFuture<Void> preCommit(); @Override ListenableFuture<Void> abort(); @Override ListenableFuture<Void> commit();  }
@Test public void testAbort() throws Exception { ThreePhaseCommitCohortProxy proxy = new ThreePhaseCommitCohortProxy(actorUtils, Arrays.asList( newCohortInfo(new CohortActor.Builder(tx).expectAbort( AbortTransactionReply.instance(CURRENT_VERSION)))), tx); verifySuccessfulFuture(proxy.abort()); verifyCohortActors(); }
@Test public void testAbortWithFailure() throws Exception { ThreePhaseCommitCohortProxy proxy = new ThreePhaseCommitCohortProxy(actorUtils, Arrays.asList( newCohortInfo(new CohortActor.Builder(tx).expectAbort(new RuntimeException("mock")))), tx); verifySuccessfulFuture(proxy.abort()); verifyCohortActors(); }
@Test public void testAbortWithFailedCohortFuture() throws Exception { List<CohortInfo> cohorts = Arrays.asList( newCohortInfoWithFailedFuture(new TestException()), newCohortInfo(new CohortActor.Builder(tx))); ThreePhaseCommitCohortProxy proxy = new ThreePhaseCommitCohortProxy(actorUtils, cohorts, tx); verifySuccessfulFuture(proxy.abort()); verifyCohortActors(); }