Search in sources :

Example 26 with CompletionCoordinatorParticipant

use of com.arjuna.wst.CompletionCoordinatorParticipant in project narayana by jbosstm.

the class Sc007TestCase method test3_8.

/**
 * test3_8 - 3.8 RetryPreparedAbort
 * Tests recovery from a communication failure during the prepare phase. Transaction times out.
 * @throws Exception on failure.
 */
public void test3_8() throws Exception {
    final String conversationId = getConversationId();
    final Sc007RetryPreparedAbortState state = new Sc007RetryPreparedAbortState();
    ProxyConversation.setConversationState(conversationId, state);
    try {
        final String serviceURI = ProxyURIRewriting.rewriteURI(conversationId, getParticipantURI());
        final CoordinationContextType context = InteropUtil.createCoordinationContext(getSourceCoordinatorURI());
        getParticipantStub().retryPreparedAbort(serviceURI, context);
        final CompletionCoordinatorParticipant participant = InteropUtil.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 : TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) CompletionCoordinatorParticipant(com.arjuna.wst.CompletionCoordinatorParticipant) Sc007RetryPreparedAbortState(com.jboss.transaction.wstf.interop.states.Sc007RetryPreparedAbortState)

Example 27 with CompletionCoordinatorParticipant

use of com.arjuna.wst.CompletionCoordinatorParticipant in project narayana by jbosstm.

the class Sc007TestCase method test3_10.

/**
 * test3_10 - 3.10 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 test3_10() throws Exception {
    final String conversationId = getConversationId();
    final Sc007PreparedAfterTimeoutState state = new Sc007PreparedAfterTimeoutState();
    ProxyConversation.setConversationState(conversationId, state);
    try {
        final String serviceURI = ProxyURIRewriting.rewriteURI(conversationId, getParticipantURI());
        final CoordinationContextType context = InteropUtil.createCoordinationContext(getSourceCoordinatorURI());
        getParticipantStub().preparedAfterTimeout(serviceURI, context);
        final CompletionCoordinatorParticipant participant = InteropUtil.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 : TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) Sc007PreparedAfterTimeoutState(com.jboss.transaction.wstf.interop.states.Sc007PreparedAfterTimeoutState) CompletionCoordinatorParticipant(com.arjuna.wst.CompletionCoordinatorParticipant)

Example 28 with CompletionCoordinatorParticipant

use of com.arjuna.wst.CompletionCoordinatorParticipant in project narayana by jbosstm.

the class Sc007TestCase method test3_6.

/**
 * test3_6 - 3.6 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 test3_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 = InteropUtil.createCoordinationContext(getSourceCoordinatorURI());
        getParticipantStub().replayCommit(serviceURI, context);
        final CompletionCoordinatorParticipant participant = InteropUtil.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.wstf.interop.states.InteropWaitState) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) CompletionCoordinatorParticipant(com.arjuna.wst.CompletionCoordinatorParticipant)

Example 29 with CompletionCoordinatorParticipant

use of com.arjuna.wst.CompletionCoordinatorParticipant in project narayana by jbosstm.

the class ATParticipantProcessor method completionRollback.

/**
 * Execute the CompletionRollback
 * @param coordinatorURI The address of the coordinator to employ.
 * @param map The current addressing context.
 *
 * @throws SoapFault11 for errors during processing
 */
public void completionRollback(final String coordinatorURI, final MAP map) throws SoapFault11 {
    try {
        final CoordinationContextType context = ATInteropUtil.createCoordinationContext(coordinatorURI);
        final CompletionCoordinatorParticipant participant = ATInteropUtil.registerCompletion(context, context.getIdentifier().getValue());
        participant.rollback();
    } catch (final Throwable th) {
        throw new SoapFault11(th);
    }
}
Also used : SoapFault11(com.arjuna.webservices11.SoapFault11) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) CompletionCoordinatorParticipant(com.arjuna.wst.CompletionCoordinatorParticipant)

Example 30 with CompletionCoordinatorParticipant

use of com.arjuna.wst.CompletionCoordinatorParticipant in project narayana by jbosstm.

the class ATParticipantProcessor method completionCommit.

/**
 * Execute the CompletionCommit
 * @param coordinatorURI The address of the coordinator to employ
 * @param map The current addressing context.
 * @throws SoapFault11 for errors during processing
 */
public void completionCommit(final String coordinatorURI, final MAP map) throws SoapFault11 {
    try {
        final CoordinationContextType context = ATInteropUtil.createCoordinationContext(coordinatorURI);
        final CompletionCoordinatorParticipant participant = ATInteropUtil.registerCompletion(context, context.getIdentifier().getValue());
        participant.commit();
    } catch (final Throwable th) {
        throw new SoapFault11(th);
    }
}
Also used : SoapFault11(com.arjuna.webservices11.SoapFault11) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) CompletionCoordinatorParticipant(com.arjuna.wst.CompletionCoordinatorParticipant)

Aggregations

CompletionCoordinatorParticipant (com.arjuna.wst.CompletionCoordinatorParticipant)30 CoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)30 InteropWaitState (com.jboss.transaction.txinterop.interop.states.InteropWaitState)10 InteropWaitState (com.jboss.transaction.wstf.interop.states.InteropWaitState)10 TransactionRolledBackException (com.arjuna.wst.TransactionRolledBackException)8 SoapFault11 (com.arjuna.webservices11.SoapFault11)4 ATInteropPreparedAfterTimeoutState (com.jboss.transaction.txinterop.interop.states.ATInteropPreparedAfterTimeoutState)1 ATInteropRetryPreparedAbortState (com.jboss.transaction.txinterop.interop.states.ATInteropRetryPreparedAbortState)1 ATInteropRetryPreparedCommitState (com.jboss.transaction.txinterop.interop.states.ATInteropRetryPreparedCommitState)1 Sc007PreparedAfterTimeoutState (com.jboss.transaction.wstf.interop.states.Sc007PreparedAfterTimeoutState)1 Sc007RetryPreparedAbortState (com.jboss.transaction.wstf.interop.states.Sc007RetryPreparedAbortState)1 Sc007RetryPreparedCommitState (com.jboss.transaction.wstf.interop.states.Sc007RetryPreparedCommitState)1