Search in sources :

Example 11 with InteropWaitState

use of com.jboss.transaction.txinterop.interop.states.InteropWaitState in project narayana by jbosstm.

the class ATTestCase method testAT5_1.

/**
 * testAT5_1 - 5.1 ReplayCommit
 * Participant registers for Durable2PC, initator initiates commit, participant fails after prepared, recovers and resends prepared. Transaction commits normally.
 * @throws Exception on failure.
 */
public void testAT5_1() throws Exception {
    final String conversationId = getConversationId();
    final InteropWaitState state = new InteropWaitState(AtomicTransactionConstants.WSAT_ACTION_COMMITTED);
    ProxyConversation.setConversationState(conversationId, state);
    try {
        final String serviceURI = ProxyURIRewriting.rewriteURI(conversationId, getParticipantURI());
        final CoordinationContextType context = ATInteropUtil.createCoordinationContext(getSourceCoordinatorURI());
        getParticipantStub().replayCommit(serviceURI, context);
        final CompletionCoordinatorParticipant participant = ATInteropUtil.registerCompletion(context, context.getIdentifier().getValue());
        participant.commit();
        state.waitForCompletion(0);
    } finally {
        ProxyConversation.clearConversationState(conversationId);
    }
    assertTrue("Conversation did not complete successfully", state.isSuccessful());
}
Also used : InteropWaitState(com.jboss.transaction.txinterop.interop.states.InteropWaitState) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) CompletionCoordinatorParticipant(com.arjuna.wst.CompletionCoordinatorParticipant)

Example 12 with InteropWaitState

use of com.jboss.transaction.txinterop.interop.states.InteropWaitState in project narayana by jbosstm.

the class ATTestCase method testAT5_6.

/**
 * testAT5_6 - 5.6 LostCommitted
 * Tests the effect of a lost Committed message.
 * @throws Exception on failure.
 */
public void testAT5_6() throws Exception {
    final String conversationId = getConversationId();
    final InteropWaitState state = new InteropWaitState(AtomicTransactionConstants.WSAT_ACTION_COMMITTED);
    ProxyConversation.setConversationState(conversationId, state);
    try {
        final String serviceURI = ProxyURIRewriting.rewriteURI(conversationId, getParticipantURI());
        final CoordinationContextType context = ATInteropUtil.createCoordinationContext(getSourceCoordinatorURI());
        getParticipantStub().lostCommitted(serviceURI, context);
        final CompletionCoordinatorParticipant participant = ATInteropUtil.registerCompletion(context, context.getIdentifier().getValue());
        participant.commit();
        state.waitForCompletion(0);
    } finally {
        ProxyConversation.clearConversationState(conversationId);
    }
    assertTrue("Conversation did not complete successfully", state.isSuccessful());
}
Also used : InteropWaitState(com.jboss.transaction.txinterop.interop.states.InteropWaitState) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) CompletionCoordinatorParticipant(com.arjuna.wst.CompletionCoordinatorParticipant)

Example 13 with InteropWaitState

use of com.jboss.transaction.txinterop.interop.states.InteropWaitState in project narayana by jbosstm.

the class ATTestCase method testAT4_1.

/**
 * testAT4_1 - 4.1 EarlyReadonly
 * Tests the case of a participant initiated ReadOnly message occurring prior to the prepare phase.
 * @throws Exception on failure.
 */
public void testAT4_1() throws Exception {
    final String conversationId = getConversationId();
    final InteropWaitState state = new InteropWaitState(AtomicTransactionConstants.WSAT_ACTION_COMMITTED);
    ProxyConversation.setConversationState(conversationId, state);
    try {
        final String serviceURI = ProxyURIRewriting.rewriteURI(conversationId, getParticipantURI());
        final CoordinationContextType context = ATInteropUtil.createCoordinationContext(getSourceCoordinatorURI());
        getParticipantStub().earlyReadonly(serviceURI, context);
        final CompletionCoordinatorParticipant participant = ATInteropUtil.registerCompletion(context, context.getIdentifier().getValue());
        participant.commit();
        state.waitForCompletion(0);
    } finally {
        ProxyConversation.clearConversationState(conversationId);
    }
    assertTrue("Conversation did not complete successfully", state.isSuccessful());
}
Also used : InteropWaitState(com.jboss.transaction.txinterop.interop.states.InteropWaitState) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) CompletionCoordinatorParticipant(com.arjuna.wst.CompletionCoordinatorParticipant)

Example 14 with InteropWaitState

use of com.jboss.transaction.txinterop.interop.states.InteropWaitState in project narayana by jbosstm.

the class ATTestCase method testAT1_2.

/**
 * testAT1_2 - 1.2 CompletionRollback
 * Participant creates and rolls back a transaction using the initiator's coordinator.
 * @throws Exception on failure.
 */
public void testAT1_2() throws Exception {
    final String conversationId = getConversationId();
    final InteropWaitState state = new InteropWaitState(AtomicTransactionConstants.WSAT_ACTION_ABORTED);
    ProxyConversation.setConversationState(conversationId, state);
    try {
        final String serviceURI = ProxyURIRewriting.rewriteURI(conversationId, getParticipantURI());
        final String coordinatorURI = ProxyURIRewriting.rewriteURI(ProxyConversation.getAlternateConversationId(conversationId), getSourceCoordinatorURI());
        getParticipantStub().completionRollback(serviceURI, coordinatorURI);
        state.waitForCompletion(getTestTimeout());
    } finally {
        ProxyConversation.clearConversationState(conversationId);
    }
    assertTrue("Conversation did not complete successfully", state.isSuccessful());
}
Also used : InteropWaitState(com.jboss.transaction.txinterop.interop.states.InteropWaitState)

Example 15 with InteropWaitState

use of com.jboss.transaction.txinterop.interop.states.InteropWaitState in project narayana by jbosstm.

the class BATestCase method testBA1_3.

/**
 * testBA1_3 - 1.3 Fail
 * The PA fails before completing its work on behalf of the activity.
 * @throws Exception on failure.
 */
public void testBA1_3() throws Exception {
    final String conversationId = getConversationId();
    final InteropWaitState state = new InteropWaitState(BusinessActivityConstants.WSBA_ACTION_FAILED);
    ProxyConversation.setConversationState(conversationId, state);
    try {
        final String serviceURI = ProxyURIRewriting.rewriteURI(conversationId, getParticipantURI());
        final CoordinationContextType context = BAInteropUtil.createAtomicOutcomeCoordinationContext(getSourceCoordinatorURI());
        getParticipantStub().fail(serviceURI, context);
        state.waitForCompletion(getTestTimeout());
        final BusinessActivityTerminator terminator = BAInteropUtil.registerTerminator(context, context.getIdentifier().getValue());
        terminator.cancel();
    } finally {
        ProxyConversation.clearConversationState(conversationId);
    }
    assertTrue("Conversation did not complete successfully", state.isSuccessful());
}
Also used : BusinessActivityTerminator(com.arjuna.wst.BusinessActivityTerminator) InteropWaitState(com.jboss.transaction.txinterop.interop.states.InteropWaitState) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)

Aggregations

InteropWaitState (com.jboss.transaction.txinterop.interop.states.InteropWaitState)18 CoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)16 CompletionCoordinatorParticipant (com.arjuna.wst.CompletionCoordinatorParticipant)10 BusinessActivityTerminator (com.arjuna.wst.BusinessActivityTerminator)6 TransactionRolledBackException (com.arjuna.wst.TransactionRolledBackException)2