Search in sources :

Example 1 with ATInteropRetryPreparedAbortState

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

the class ATTestCase method testAT5_3.

/**
 * testAT5_3 - 5.3 RetryPreparedAbort
 * Tests recovery from a communication failure during the prepare phase. Transaction times out.
 * @throws Exception on failure.
 */
public void testAT5_3() throws Exception {
    final String conversationId = getConversationId();
    final ATInteropRetryPreparedAbortState state = new ATInteropRetryPreparedAbortState();
    ProxyConversation.setConversationState(conversationId, state);
    try {
        final String serviceURI = ProxyURIRewriting.rewriteURI(conversationId, getParticipantURI());
        final CoordinationContextType context = ATInteropUtil.createCoordinationContext(getSourceCoordinatorURI());
        getParticipantStub().retryPreparedAbort(serviceURI, context);
        final CompletionCoordinatorParticipant participant = ATInteropUtil.registerCompletion(context, context.getIdentifier().getValue());
        participant.commit();
        fail("Transaction rollback expected");
    } catch (final TransactionRolledBackException trbe) {
        state.waitForCompletion(getTestTimeout());
    } finally {
        ProxyConversation.clearConversationState(conversationId);
    }
    assertTrue("Conversation did not complete successfully", state.isSuccessful());
}
Also used : ATInteropRetryPreparedAbortState(com.jboss.transaction.txinterop.interop.states.ATInteropRetryPreparedAbortState) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) CompletionCoordinatorParticipant(com.arjuna.wst.CompletionCoordinatorParticipant)

Aggregations

CompletionCoordinatorParticipant (com.arjuna.wst.CompletionCoordinatorParticipant)1 TransactionRolledBackException (com.arjuna.wst.TransactionRolledBackException)1 ATInteropRetryPreparedAbortState (com.jboss.transaction.txinterop.interop.states.ATInteropRetryPreparedAbortState)1 CoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)1