@Test public void test_vote_yes_if_both_yes() throws Exception { when(businessObject.vote(transcationId)).thenReturn(TransactionManager.Vote.YES); when(intTxManager.vote(transcationId)).thenReturn(TransactionManager.Vote.YES); TransactionManager.Vote vote = txMgr.vote(transcationId); assertEquals(TransactionManager.Vote.YES, vote); }
@Override public Vote vote(UUID transactionId) throws TransactionExecutionException { Vote vote = this.internalTransactionManager.vote(transactionId); if (vote.equals(Vote.YES)) { Vote voteExtResource = this.getBusinessObject(transactionId).vote(transactionId); if (!Vote.YES.equals(voteExtResource)) { logger.log(Level.WARNING, "inconsistent resource state; transaction aborted."); this.internalTransactionManager.abort(transactionId); vote = Vote.NO; } } return vote; }
ExtResourceTransactionManager implements TransactionManager, Serializable { @Override public Vote vote(UUID transactionId) throws TransactionExecutionException { Vote vote = this.internalTransactionManager.vote(transactionId); if (vote.equals(Vote.YES)) { Vote voteExtResource = this.getBusinessObject(transactionId).vote(transactionId); if (!Vote.YES.equals(voteExtResource)) { logger.log(Level.WARNING, "inconsistent resource state; transaction aborted."); this.internalTransactionManager.abort(transactionId); vote = Vote.NO; } } return vote; } }
ExtResourceTransactionManager implements TransactionManager, Serializable { @Override public Vote vote(UUID transactionId) throws TransactionExecutionException { Vote vote = this.internalTransactionManager.vote(transactionId); if (vote.equals(Vote.YES)) { Vote voteExtResource = this.getBusinessObject(transactionId).vote(transactionId); if (!Vote.YES.equals(voteExtResource)) { logger.log(Level.WARNING, "inconsistent resource state; transaction aborted."); this.internalTransactionManager.abort(transactionId); vote = Vote.NO; } } return vote; } ExtResourceTransactionManager(
            SandboxProvider sandboxProvider, TransactionManager internalTransactionManager); }
ExtResourceTransactionManager implements TransactionManager, Serializable { @Override public Vote vote(UUID transactionId) throws TransactionExecutionException { Vote vote = this.internalTransactionManager.vote(transactionId); if (vote.equals(Vote.YES)) { Vote voteExtResource = this.getBusinessObject(transactionId).vote(transactionId); if (!Vote.YES.equals(voteExtResource)) { logger.log(Level.WARNING, "inconsistent resource state; transaction aborted."); this.internalTransactionManager.abort(transactionId); vote = Vote.NO; } } return vote; } ExtResourceTransactionManager(
            SandboxProvider sandboxProvider, TransactionManager internalTransactionManager); @Override void join(UUID transactionId); @Override void leave(UUID transactionId); @Override Vote vote(UUID transactionId); @Override void commit(UUID transactionId); @Override void abort(UUID transactionId); }
ExtResourceTransactionManager implements TransactionManager, Serializable { @Override public Vote vote(UUID transactionId) throws TransactionExecutionException { Vote vote = this.internalTransactionManager.vote(transactionId); if (vote.equals(Vote.YES)) { Vote voteExtResource = this.getBusinessObject(transactionId).vote(transactionId); if (!Vote.YES.equals(voteExtResource)) { logger.log(Level.WARNING, "inconsistent resource state; transaction aborted."); this.internalTransactionManager.abort(transactionId); vote = Vote.NO; } } return vote; } ExtResourceTransactionManager(
            SandboxProvider sandboxProvider, TransactionManager internalTransactionManager); @Override void join(UUID transactionId); @Override void leave(UUID transactionId); @Override Vote vote(UUID transactionId); @Override void commit(UUID transactionId); @Override void abort(UUID transactionId);  }