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