use of org.jboss.narayana.rest.integration.api.Aborted in project narayana by jbosstm.
the class BasicIntegrationTestCase method testHeuristicCommitAfterUnsuccessfullPrepare.
@Test
public void testHeuristicCommitAfterUnsuccessfullPrepare() {
txSupport.startTx();
LoggingParticipant loggingParticipant = new LoggingParticipant(new Aborted());
HeuristicParticipant heuristicParticipant = new HeuristicParticipant(HeuristicType.HEURISTIC_COMMIT, new Prepared());
ParticipantsManagerFactory.getInstance().enlist(APPLICATION_ID, txSupport.getDurableParticipantEnlistmentURI(), loggingParticipant);
ParticipantsManagerFactory.getInstance().enlist(APPLICATION_ID, txSupport.getDurableParticipantEnlistmentURI(), heuristicParticipant);
final String txStatus = TxSupport.getStatus(txSupport.commitTx());
Assert.assertEquals(TxStatus.TransactionHeuristicCommit.name(), txStatus);
Assert.assertEquals(Arrays.asList(new String[] { "prepare", "rollback" }), loggingParticipant.getInvocations());
Assert.assertEquals(Arrays.asList(new String[] { "prepare", "rollback" }), heuristicParticipant.getInvocations());
}
use of org.jboss.narayana.rest.integration.api.Aborted in project narayana by jbosstm.
the class ParticipantResourceTestCase method testPrepareOutcomeAborted.
@Test
public void testPrepareOutcomeAborted() throws Exception {
final LoggingParticipant participant = new LoggingParticipant(new Aborted());
registerParticipant(participantId, participant);
ParticipantInformation participantInformation = ParticipantsContainer.getInstance().getParticipantInformation(participantId);
Response stringResponse = prepareParticipant(participantId);
Assert.assertEquals(409, stringResponse.getStatus());
Assert.assertEquals(TxStatus.TransactionRolledBack.name(), TxSupport.getStatus(stringResponse.readEntity(String.class)));
Assert.assertEquals(TxStatus.TransactionRolledBack.name(), participantInformation.getStatus());
Assert.assertEquals(Arrays.asList(new String[] { "prepare", "rollback" }), participant.getInvocations());
Assert.assertNull(ParticipantsContainer.getInstance().getParticipantInformation(participantId));
}
Aggregations