use of org.jboss.narayana.rest.integration.test.common.LoggingVolatileParticipant in project narayana by jbosstm.
the class VolatileParticipantResourceTestCase method testBeforeCompletion.
@Test
public void testBeforeCompletion() throws Exception {
LoggingVolatileParticipant participant = new LoggingVolatileParticipant();
registerParticipant(participantId, participant);
Response response = beforeCompletion(participantId);
Assert.assertEquals(200, response.getStatus());
List<String> invocations = participant.getInvocations();
Assert.assertEquals(1, invocations.size());
Assert.assertEquals("beforeCompletion", invocations.get(0));
}
use of org.jboss.narayana.rest.integration.test.common.LoggingVolatileParticipant in project narayana by jbosstm.
the class BasicIntegrationTestCase method testRollbackWithVolatileParticipant.
@Test
public void testRollbackWithVolatileParticipant() {
txSupport.startTx();
LoggingParticipant loggingParticipant = new LoggingParticipant(new Prepared());
LoggingVolatileParticipant loggingVolatileParticipant = new LoggingVolatileParticipant();
ParticipantsManagerFactory.getInstance().enlist(APPLICATION_ID, txSupport.getDurableParticipantEnlistmentURI(), loggingParticipant);
ParticipantsManagerFactory.getInstance().enlistVolatileParticipant(txSupport.getVolatileParticipantEnlistmentURI(), loggingVolatileParticipant);
final String txStatus = TxSupport.getStatus(txSupport.rollbackTx());
Assert.assertEquals(TxStatus.TransactionRolledBack.name(), txStatus);
Assert.assertEquals(Arrays.asList(new String[] { "rollback" }), loggingParticipant.getInvocations());
Assert.assertEquals(Arrays.asList(new String[] { "afterCompletion" }), loggingVolatileParticipant.getInvocations());
Assert.assertEquals(TxStatus.TransactionRolledBack, loggingVolatileParticipant.getTxStatus());
}
use of org.jboss.narayana.rest.integration.test.common.LoggingVolatileParticipant in project narayana by jbosstm.
the class BasicIntegrationTestCase method testCommitWithVolatileParticipant.
@Test
public void testCommitWithVolatileParticipant() {
txSupport.startTx();
LoggingParticipant loggingParticipant = new LoggingParticipant(new Prepared());
LoggingVolatileParticipant loggingVolatileParticipant = new LoggingVolatileParticipant();
ParticipantsManagerFactory.getInstance().enlist(APPLICATION_ID, txSupport.getDurableParticipantEnlistmentURI(), loggingParticipant);
ParticipantsManagerFactory.getInstance().enlistVolatileParticipant(txSupport.getVolatileParticipantEnlistmentURI(), loggingVolatileParticipant);
final String txStatus = TxSupport.getStatus(txSupport.commitTx());
Assert.assertEquals(TxStatus.TransactionCommitted.name(), txStatus);
Assert.assertEquals(Arrays.asList(new String[] { "commitOnePhase" }), loggingParticipant.getInvocations());
Assert.assertEquals(Arrays.asList(new String[] { "beforeCompletion", "afterCompletion" }), loggingVolatileParticipant.getInvocations());
Assert.assertEquals(TxStatus.TransactionCommitted, loggingVolatileParticipant.getTxStatus());
}
use of org.jboss.narayana.rest.integration.test.common.LoggingVolatileParticipant in project narayana by jbosstm.
the class VolatileParticipantResourceTestCase method testAfterCompletion.
@Test
public void testAfterCompletion() throws Exception {
LoggingVolatileParticipant participant = new LoggingVolatileParticipant();
registerParticipant(participantId, participant);
Response response = afterCompletion(participantId, TxStatus.TransactionCommitted);
Assert.assertEquals(200, response.getStatus());
List<String> invocations = participant.getInvocations();
Assert.assertEquals(1, invocations.size());
Assert.assertEquals("afterCompletion", invocations.get(0));
Assert.assertEquals(TxStatus.TransactionCommitted, participant.getTxStatus());
response = beforeCompletion(participantId);
Assert.assertEquals(404, response.getStatus());
}
Aggregations