Search in sources :

Example 11 with LoggingParticipant

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);
}
Also used : LoggingParticipant(org.jboss.narayana.rest.integration.test.common.LoggingParticipant) Uid(com.arjuna.ats.arjuna.common.Uid) Prepared(org.jboss.narayana.rest.integration.api.Prepared) ParticipantInformation(org.jboss.narayana.rest.integration.ParticipantInformation) TestParticipantDeserializer(org.jboss.narayana.rest.integration.test.common.TestParticipantDeserializer) Test(org.junit.Test)

Example 12 with LoggingParticipant

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());
}
Also used : LoggingParticipant(org.jboss.narayana.rest.integration.test.common.LoggingParticipant) Response(javax.ws.rs.core.Response) Prepared(org.jboss.narayana.rest.integration.api.Prepared) ParticipantInformation(org.jboss.narayana.rest.integration.ParticipantInformation) Test(org.junit.Test)

Example 13 with LoggingParticipant

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());
}
Also used : LoggingParticipant(org.jboss.narayana.rest.integration.test.common.LoggingParticipant) Response(javax.ws.rs.core.Response) Prepared(org.jboss.narayana.rest.integration.api.Prepared) ParticipantInformation(org.jboss.narayana.rest.integration.ParticipantInformation) Test(org.junit.Test)

Example 14 with LoggingParticipant

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));
}
Also used : LoggingParticipant(org.jboss.narayana.rest.integration.test.common.LoggingParticipant) Response(javax.ws.rs.core.Response) Prepared(org.jboss.narayana.rest.integration.api.Prepared) ParticipantInformation(org.jboss.narayana.rest.integration.ParticipantInformation) Test(org.junit.Test)

Example 15 with LoggingParticipant

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));
}
Also used : LoggingParticipant(org.jboss.narayana.rest.integration.test.common.LoggingParticipant) Response(javax.ws.rs.core.Response) Prepared(org.jboss.narayana.rest.integration.api.Prepared) ParticipantInformation(org.jboss.narayana.rest.integration.ParticipantInformation) Test(org.junit.Test)

Aggregations

LoggingParticipant (org.jboss.narayana.rest.integration.test.common.LoggingParticipant)30 Test (org.junit.Test)30 Prepared (org.jboss.narayana.rest.integration.api.Prepared)25 ParticipantInformation (org.jboss.narayana.rest.integration.ParticipantInformation)15 Response (javax.ws.rs.core.Response)14 Aborted (org.jboss.narayana.rest.integration.api.Aborted)5 ReadOnly (org.jboss.narayana.rest.integration.api.ReadOnly)4 HeuristicParticipant (org.jboss.narayana.rest.integration.test.common.HeuristicParticipant)4 Uid (com.arjuna.ats.arjuna.common.Uid)2 LoggingVolatileParticipant (org.jboss.narayana.rest.integration.test.common.LoggingVolatileParticipant)2 Link (javax.ws.rs.core.Link)1 TestParticipantDeserializer (org.jboss.narayana.rest.integration.test.common.TestParticipantDeserializer)1