Search in sources :

Example 16 with CompletionCoordinatorParticipant

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

the class ATTestCase method testAT4_2.

/**
 * testAT4_2 - 4.2 EarlyAborted
 * Tests the case of a participant initiated Aborted message occurring prior to the prepare phase.
 * @throws Exception on failure.
 */
public void testAT4_2() throws Exception {
    final String conversationId = getConversationId();
    final InteropWaitState state = new InteropWaitState(AtomicTransactionConstants.WSAT_ACTION_ABORTED, 2);
    ProxyConversation.setConversationState(conversationId, state);
    try {
        final String serviceURI = ProxyURIRewriting.rewriteURI(conversationId, getParticipantURI());
        final CoordinationContextType context = ATInteropUtil.createCoordinationContext(getSourceCoordinatorURI());
        getParticipantStub().earlyAborted(serviceURI, context);
        final CompletionCoordinatorParticipant participant = ATInteropUtil.registerCompletion(context, context.getIdentifier().getValue());
        participant.commit();
        fail("Transaction rollback expected");
    } catch (final TransactionRolledBackException trbe) {
        state.waitForCompletion(0);
    } finally {
        ProxyConversation.clearConversationState(conversationId);
    }
    assertTrue("Conversation did not complete successfully", state.isSuccessful());
}
Also used : TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) 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 17 with CompletionCoordinatorParticipant

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

the class ATTestCase method testAT5_2.

/**
 * testAT5_2 - 5.2 RetryPreparedCommit
 * Tests recovery from a communication failure during the prepare phase. Transaction commits normally.
 * @throws Exception on failure.
 */
public void testAT5_2() throws Exception {
    final String conversationId = getConversationId();
    final ATInteropRetryPreparedCommitState state = new ATInteropRetryPreparedCommitState();
    ProxyConversation.setConversationState(conversationId, state);
    try {
        final String serviceURI = ProxyURIRewriting.rewriteURI(conversationId, getParticipantURI());
        final CoordinationContextType context = ATInteropUtil.createCoordinationContext(getSourceCoordinatorURI());
        getParticipantStub().retryPreparedCommit(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 : ATInteropRetryPreparedCommitState(com.jboss.transaction.txinterop.interop.states.ATInteropRetryPreparedCommitState) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) CompletionCoordinatorParticipant(com.arjuna.wst.CompletionCoordinatorParticipant)

Example 18 with CompletionCoordinatorParticipant

use of com.arjuna.wst.CompletionCoordinatorParticipant 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 19 with CompletionCoordinatorParticipant

use of com.arjuna.wst.CompletionCoordinatorParticipant 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 20 with CompletionCoordinatorParticipant

use of com.arjuna.wst.CompletionCoordinatorParticipant 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)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