use of org.jboss.narayana.rest.integration.ParticipantInformation 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));
}
use of org.jboss.narayana.rest.integration.ParticipantInformation in project narayana by jbosstm.
the class ParticipantResourceTestCase method testRollback.
@Test
public void testRollback() throws Exception {
LoggingParticipant participant = new LoggingParticipant(new Prepared());
registerParticipant(participantId, participant);
ParticipantInformation participantInformation = ParticipantsContainer.getInstance().getParticipantInformation(participantId);
Response stringResponse = rollbackParticipant(participantInformation.getId());
Assert.assertEquals(200, stringResponse.getStatus());
Assert.assertEquals(TxStatus.TransactionRolledBack.name(), participantInformation.getStatus());
Assert.assertEquals(Arrays.asList(new String[] { "rollback" }), participant.getInvocations());
Assert.assertNull(ParticipantsContainer.getInstance().getParticipantInformation(participantId));
}
use of org.jboss.narayana.rest.integration.ParticipantInformation in project narayana by jbosstm.
the class ParticipantResourceTestCase method testCommit.
@Test
public void testCommit() throws Exception {
LoggingParticipant participant = new LoggingParticipant(new Prepared());
registerParticipant(participantId, participant);
ParticipantInformation participantInformation = ParticipantsContainer.getInstance().getParticipantInformation(participantId);
participantInformation.setStatus(TxStatus.TransactionPrepared.name());
Response stringResponse = commitParticipant(participantInformation.getId());
Assert.assertEquals(200, stringResponse.getStatus());
Assert.assertEquals(TxStatus.TransactionCommitted.name(), participantInformation.getStatus());
Assert.assertEquals(Arrays.asList(new String[] { "commit" }), participant.getInvocations());
Assert.assertNull(ParticipantsContainer.getInstance().getParticipantInformation(participantId));
}
Aggregations