Search in sources :

Example 71 with CoordinationContextType

use of org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType 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 72 with CoordinationContextType

use of org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType 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 73 with CoordinationContextType

use of org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType 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)

Example 74 with CoordinationContextType

use of org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType in project narayana by jbosstm.

the class ATTestCase method testAT4_1.

/**
 * testAT4_1 - 4.1 EarlyReadonly
 * Tests the case of a participant initiated ReadOnly message occurring prior to the prepare phase.
 * @throws Exception on failure.
 */
public void testAT4_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().earlyReadonly(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 75 with CoordinationContextType

use of org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType in project narayana by jbosstm.

the class ParticipantProcessor 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 = InteropUtil.createCoordinationContext(coordinatorURI);
        final CompletionCoordinatorParticipant participant = InteropUtil.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)

Aggregations

CoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)107 SoapFault11 (com.arjuna.webservices11.SoapFault11)43 MAP (org.jboss.ws.api.addressing.MAP)41 Action (javax.xml.ws.Action)38 RequestWrapper (javax.xml.ws.RequestWrapper)38 MessageContext (javax.xml.ws.handler.MessageContext)38 CompletionCoordinatorParticipant (com.arjuna.wst.CompletionCoordinatorParticipant)30 InteropWaitState (com.jboss.transaction.txinterop.interop.states.InteropWaitState)16 CoordinationContext (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext)13 TransactionRolledBackException (com.arjuna.wst.TransactionRolledBackException)12 InvalidCreateParametersException (com.arjuna.wsc.InvalidCreateParametersException)10 BusinessActivityTerminator (com.arjuna.wst.BusinessActivityTerminator)10 InteropWaitState (com.jboss.transaction.wstf.interop.states.InteropWaitState)10 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)10 TxContextImple (com.arjuna.mwlabs.wst11.at.context.TxContextImple)7 SoapFault (com.arjuna.webservices.SoapFault)6 SystemException (com.arjuna.wst.SystemException)6 SOAPEnvelope (javax.xml.soap.SOAPEnvelope)6 SOAPHeaderElement (javax.xml.soap.SOAPHeaderElement)6 TxContext (com.arjuna.mw.wst.TxContext)5