Search in sources :

Example 11 with CompletionCoordinatorParticipant

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

the class ATTestCase method testAT5_4.

/**
 * testAT5_4 - 5.4 RetryCommit
 * Tests recovery from a communication failure during the commit phase. Transaction commits normally.
 * @throws Exception on failure.
 */
public void testAT5_4() 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().retryCommit(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 CompletionCoordinatorParticipant

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

the class ATTestCase method testAT2_2.

/**
 * testAT2_2 - 2.2 Rollback
 * Participant registers for Durable2PC, initiator rolls back.
 * @throws Exception on failure.
 */
public void testAT2_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 CoordinationContextType context = ATInteropUtil.createCoordinationContext(getSourceCoordinatorURI());
        getParticipantStub().rollback(serviceURI, context);
        final CompletionCoordinatorParticipant participant = ATInteropUtil.registerCompletion(context, context.getIdentifier().getValue());
        participant.rollback();
        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 CompletionCoordinatorParticipant

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

Example 14 with CompletionCoordinatorParticipant

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

the class ATTestCase method testAT2_1.

/**
 * testAT2_1 - 2.1 Commit
 * Participant registers for Durable2PC, initiator commits, transaction commits successfully.
 * @throws Exception on failure.
 */
public void testAT2_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().commit(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 15 with CompletionCoordinatorParticipant

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

the class ATTestCase method testAT3_3.

/**
 * testAT3_3 - 3.3 VolatileAndDurable
 * Tests registration during the volatile prepare phase.
 * @throws Exception on failure.
 */
public void testAT3_3() 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().volatileAndDurable(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)

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