Search in sources :

Example 6 with ReadOnly

use of org.jboss.narayana.rest.integration.api.ReadOnly in project narayana by jbosstm.

the class BasicIntegrationTestCase method testReadOnly.

@Test
public void testReadOnly() {
    txSupport.startTx();
    final List<LoggingParticipant> participants = Arrays.asList(new LoggingParticipant[] { new LoggingParticipant(new ReadOnly()), new LoggingParticipant(new Prepared()), new LoggingParticipant(new Prepared()) });
    for (LoggingParticipant p : participants) {
        ParticipantsManagerFactory.getInstance().enlist(APPLICATION_ID, txSupport.getDurableParticipantEnlistmentURI(), p);
    }
    txSupport.commitTx();
    // One of the participants was only prepared, while other two were prepared and commited.
    Assert.assertEquals(5, participants.get(0).getInvocations().size() + participants.get(1).getInvocations().size() + participants.get(2).getInvocations().size());
    for (LoggingParticipant p : participants) {
        if (p.getInvocations().size() == 1) {
            Assert.assertEquals(Arrays.asList(new String[] { "prepare" }), p.getInvocations());
        } else {
            Assert.assertEquals(Arrays.asList(new String[] { "prepare", "commit" }), p.getInvocations());
        }
    }
}
Also used : LoggingParticipant(org.jboss.narayana.rest.integration.test.common.LoggingParticipant) ReadOnly(org.jboss.narayana.rest.integration.api.ReadOnly) Prepared(org.jboss.narayana.rest.integration.api.Prepared) Test(org.junit.Test)

Aggregations

ReadOnly (org.jboss.narayana.rest.integration.api.ReadOnly)6 Test (org.junit.Test)5 LoggingParticipant (org.jboss.narayana.rest.integration.test.common.LoggingParticipant)4 Response (javax.ws.rs.core.Response)3 Prepared (org.jboss.narayana.rest.integration.api.Prepared)3 ParticipantInformation (org.jboss.narayana.rest.integration.ParticipantInformation)2 Link (javax.ws.rs.core.Link)1 Aborted (org.jboss.narayana.rest.integration.api.Aborted)1 ParticipantException (org.jboss.narayana.rest.integration.api.ParticipantException)1 Vote (org.jboss.narayana.rest.integration.api.Vote)1 LoggingParticipant (org.wildfly.test.extension.rts.common.LoggingParticipant)1