use of org.jboss.narayana.rest.integration.ParticipantInformation in project narayana by jbosstm.
the class ParticipantResourceTestCase method testGetStatus.
@Test
public void testGetStatus() throws Exception {
registerParticipant(participantId, new LoggingParticipant(new ReadOnly()));
ParticipantInformation participantInformation = ParticipantsContainer.getInstance().getParticipantInformation(participantId);
participantInformation.setStatus(TxStatus.TransactionPrepared.name());
Response response = getParticipantStatus(participantId);
Assert.assertEquals(200, response.getStatus());
Assert.assertTrue(TxStatus.isPrepare(TxSupport.getStatus(response.readEntity(String.class))));
participantInformation.setStatus(TxStatus.TransactionCommitted.name());
response = ClientBuilder.newClient().target(PARTICIPANT_URL + "/" + participantId).request().get();
Assert.assertTrue(TxStatus.isCommit(TxSupport.getStatus(response.readEntity(String.class))));
}
use of org.jboss.narayana.rest.integration.ParticipantInformation in project narayana by jbosstm.
the class ParticipantsManagerTestCase method registerParticipant.
private void registerParticipant(final String participantId, final Participant participant) throws MalformedURLException {
ParticipantInformation participantInformation = new ParticipantInformation(participantId, APPLICATION_ID, "", participant);
participantInformation.setStatus(TxStatus.TransactionActive.name());
ParticipantsContainer.getInstance().addParticipantInformation(participantId, participantInformation);
}
use of org.jboss.narayana.rest.integration.ParticipantInformation in project narayana by jbosstm.
the class ParticipantResourceTestCase method testForgetHeuristicWithoutHeuristic.
@Test
@SuppressWarnings("rawtypes")
public void testForgetHeuristicWithoutHeuristic() throws Exception {
LoggingParticipant participant = new LoggingParticipant(new Prepared());
registerParticipant(participantId, participant);
Response simpleResponse = forgetParticipantHeuristic(participantId);
ParticipantInformation participantInformation = ParticipantsContainer.getInstance().getParticipantInformation(participantId);
Assert.assertEquals(412, simpleResponse.getStatus());
Assert.assertEquals(TxStatus.TransactionActive.name(), participantInformation.getStatus());
}
use of org.jboss.narayana.rest.integration.ParticipantInformation in project narayana by jbosstm.
the class ParticipantResourceTestCase method testForgetHeuristic.
@Test
@SuppressWarnings("rawtypes")
public void testForgetHeuristic() throws Exception {
LoggingParticipant participant = new LoggingParticipant(new Prepared());
registerParticipant(participantId, participant);
ParticipantInformation participantInformation = ParticipantsContainer.getInstance().getParticipantInformation(participantId);
participantInformation.setStatus(TxStatus.TransactionHeuristicRollback.name());
Response simpleResponse = forgetParticipantHeuristic(participantId);
Assert.assertEquals(200, simpleResponse.getStatus());
Assert.assertNull(ParticipantsContainer.getInstance().getParticipantInformation(participantId));
}
use of org.jboss.narayana.rest.integration.ParticipantInformation in project narayana by jbosstm.
the class ParticipantResourceTestCase method testCommitWithoutPrepare.
@Test
public void testCommitWithoutPrepare() throws Exception {
LoggingParticipant participant = new LoggingParticipant(new Prepared());
registerParticipant(participantId, participant);
ParticipantInformation participantInformation = ParticipantsContainer.getInstance().getParticipantInformation(participantId);
Response stringResponse = commitParticipant(participantInformation.getId());
Assert.assertEquals(412, stringResponse.getStatus());
}
Aggregations