use of org.jboss.narayana.rest.integration.ParticipantInformation in project narayana by jbosstm.
the class TransactionalService method getParticipantInvocations.
@GET
public Response getParticipantInvocations(@QueryParam("participantId") final String participantId) {
ParticipantInformation information = ParticipantsContainer.getInstance().getParticipantInformation(participantId);
if (information == null) {
return Response.status(404).build();
}
final JSONArray jsonArray = new JSONArray(((LoggingParticipant) information.getParticipant()).getInvocations());
return Response.ok().entity(jsonArray.toString()).build();
}
use of org.jboss.narayana.rest.integration.ParticipantInformation in project narayana by jbosstm.
the class ParticipantsManagerTestCase method testReportHeuristic.
@Test
public void testReportHeuristic() throws MalformedURLException {
final String participantId = new Uid().toString();
registerParticipant(participantId, new LoggingParticipant(new Prepared()));
final ParticipantInformation participantInformation = ParticipantsContainer.getInstance().getParticipantInformation(participantId);
participantInformation.setStatus(TxStatus.TransactionPrepared.name());
participantsManager.reportHeuristic(participantId, HeuristicType.HEURISTIC_ROLLBACK);
Assert.assertEquals(TxStatus.TransactionHeuristicRollback.name(), participantInformation.getStatus());
}
use of org.jboss.narayana.rest.integration.ParticipantInformation in project narayana by jbosstm.
the class RecoveryManagerTestCase method testRecoveryWithoutDeserializer.
@Test
public void testRecoveryWithoutDeserializer() {
final String participantId = new Uid().toString();
final LoggingParticipant loggingParticipantBefore = new LoggingParticipant(new Prepared());
loggingParticipantBefore.commit();
final ParticipantInformation participantInformationBefore = new ParticipantInformation(participantId, APPLICATION_ID + "1", "", loggingParticipantBefore, TxStatus.TransactionCommitted.name());
ParticipantsContainer.getInstance().clear();
ParticipantsManagerFactory.getInstance().setBaseUrl("");
RecoveryManager.getInstance().persistParticipantInformation(participantInformationBefore);
RecoveryManager.getInstance().registerDeserializer(APPLICATION_ID + "2", new TestParticipantDeserializer());
final ParticipantInformation participantInformationAfter = ParticipantsContainer.getInstance().getParticipantInformation(participantId);
Assert.assertNull(participantInformationAfter);
}
use of org.jboss.narayana.rest.integration.ParticipantInformation in project narayana by jbosstm.
the class ParticipantResourceTestCase method testPreparePreparedTransaction.
@Test
public void testPreparePreparedTransaction() throws Exception {
final LoggingParticipant participant = new LoggingParticipant(new Prepared());
registerParticipant(participantId, participant);
ParticipantInformation participantInformation = ParticipantsContainer.getInstance().getParticipantInformation(participantId);
participantInformation.setStatus(TxStatus.TransactionPrepared.name());
Response stringResponse = prepareParticipant(participantId);
Assert.assertEquals(412, stringResponse.getStatus());
}
use of org.jboss.narayana.rest.integration.ParticipantInformation in project narayana by jbosstm.
the class ParticipantResourceTestCase method testCommitOnePhaseAfterPrepare.
@Test
public void testCommitOnePhaseAfterPrepare() throws Exception {
LoggingParticipant participant = new LoggingParticipant(new Prepared());
registerParticipant(participantId, participant);
ParticipantInformation participantInformation = ParticipantsContainer.getInstance().getParticipantInformation(participantId);
participantInformation.setStatus(TxStatus.TransactionPrepared.name());
Response stringResponse = commitParticipantInOnePhase(participantInformation.getId());
Assert.assertEquals(412, stringResponse.getStatus());
}
Aggregations