Search in sources :

Example 1 with ATInteropPreparedAfterTimeoutState

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

the class ATTestCase method testAT5_5.

/**
 * testAT5_5 - 5.5 PreparedAfterTimeout
 * Tests recovery from a communication failure during the prepare phase. Transaction times out. Two participants, volatile and durable.
 * @throws Exception on failure.
 */
public void testAT5_5() throws Exception {
    final String conversationId = getConversationId();
    final ATInteropPreparedAfterTimeoutState state = new ATInteropPreparedAfterTimeoutState();
    ProxyConversation.setConversationState(conversationId, state);
    try {
        final String serviceURI = ProxyURIRewriting.rewriteURI(conversationId, getParticipantURI());
        final CoordinationContextType context = ATInteropUtil.createCoordinationContext(getSourceCoordinatorURI());
        getParticipantStub().preparedAfterTimeout(serviceURI, context);
        final CompletionCoordinatorParticipant participant = ATInteropUtil.registerCompletion(context, context.getIdentifier().getValue());
        participant.commit();
        fail("Transaction rollback expected");
    } catch (final TransactionRolledBackException tre) {
        state.waitForCompletion(getTestTimeout());
    } finally {
        ProxyConversation.clearConversationState(conversationId);
    }
    assertTrue("Conversation did not complete successfully", state.isSuccessful());
}
Also used : ATInteropPreparedAfterTimeoutState(com.jboss.transaction.txinterop.interop.states.ATInteropPreparedAfterTimeoutState) 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 ATInteropPreparedAfterTimeoutState (com.jboss.transaction.txinterop.interop.states.ATInteropPreparedAfterTimeoutState)1 CoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)1