Search in sources :

Example 16 with InteropWaitState

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

the class BATestCase method testBA1_11.

/**
 * testBA1_11 - 1.11 MessageLossAndRecovery
 * The IA cancels the activity before the PA completes its work on behalf of the activity.
 * @throws Exception on failure.
 */
public void testBA1_11() throws Exception {
    final String conversationId = getConversationId();
    final InteropWaitState state = new InteropWaitState(BusinessActivityConstants.WSBA_ACTION_COMPENSATED);
    ProxyConversation.setConversationState(conversationId, state);
    try {
        final String serviceURI = ProxyURIRewriting.rewriteURI(conversationId, getParticipantURI());
        final CoordinationContextType context = BAInteropUtil.createAtomicOutcomeCoordinationContext(getSourceCoordinatorURI());
        getParticipantStub().messageLossAndRecovery(serviceURI, context);
        final BusinessActivityTerminator terminator = BAInteropUtil.registerTerminator(context, context.getIdentifier().getValue());
        terminator.complete();
        terminator.cancel();
        state.waitForCompletion(0);
    } finally {
        ProxyConversation.clearConversationState(conversationId);
    }
    assertTrue("Conversation did not complete successfully", state.isSuccessful());
}
Also used : BusinessActivityTerminator(com.arjuna.wst.BusinessActivityTerminator) InteropWaitState(com.jboss.transaction.txinterop.interop.states.InteropWaitState) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)

Example 17 with InteropWaitState

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

the class BATestCase method testBA1_2.

/**
 * testBA1_2 - 1.2 Exit
 * The PA exits without completing any work on behalf of the activity.
 * @throws Exception on failure.
 */
public void testBA1_2() throws Exception {
    final String conversationId = getConversationId();
    final InteropWaitState state = new InteropWaitState(BusinessActivityConstants.WSBA_ACTION_EXITED);
    ProxyConversation.setConversationState(conversationId, state);
    try {
        final String serviceURI = ProxyURIRewriting.rewriteURI(conversationId, getParticipantURI());
        final CoordinationContextType context = BAInteropUtil.createAtomicOutcomeCoordinationContext(getSourceCoordinatorURI());
        getParticipantStub().exit(serviceURI, context);
        state.waitForCompletion(getTestTimeout());
        final BusinessActivityTerminator terminator = BAInteropUtil.registerTerminator(context, context.getIdentifier().getValue());
        terminator.cancel();
    } finally {
        ProxyConversation.clearConversationState(conversationId);
    }
    assertTrue("Conversation did not complete successfully", state.isSuccessful());
}
Also used : BusinessActivityTerminator(com.arjuna.wst.BusinessActivityTerminator) InteropWaitState(com.jboss.transaction.txinterop.interop.states.InteropWaitState) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)

Example 18 with InteropWaitState

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

the class BATestCase method testBA1_1.

/**
 * testBA1_1 - 1.1 Cancel
 * The IA cancels the activity before the PA completes its work on behalf of the activity.
 * @throws Exception on failure.
 */
public void testBA1_1() throws Exception {
    final String conversationId = getConversationId();
    final InteropWaitState state = new InteropWaitState(BusinessActivityConstants.WSBA_ACTION_CANCELLED);
    ProxyConversation.setConversationState(conversationId, state);
    try {
        final String serviceURI = ProxyURIRewriting.rewriteURI(conversationId, getParticipantURI());
        final CoordinationContextType context = BAInteropUtil.createAtomicOutcomeCoordinationContext(getSourceCoordinatorURI());
        getParticipantStub().cancel(serviceURI, context);
        final BusinessActivityTerminator terminator = BAInteropUtil.registerTerminator(context, context.getIdentifier().getValue());
        terminator.cancel();
        state.waitForCompletion(0);
    } finally {
        ProxyConversation.clearConversationState(conversationId);
    }
    assertTrue("Conversation did not complete successfully", state.isSuccessful());
}
Also used : BusinessActivityTerminator(com.arjuna.wst.BusinessActivityTerminator) InteropWaitState(com.jboss.transaction.txinterop.interop.states.InteropWaitState) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)

Aggregations

InteropWaitState (com.jboss.transaction.txinterop.interop.states.InteropWaitState)18 CoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)16 CompletionCoordinatorParticipant (com.arjuna.wst.CompletionCoordinatorParticipant)10 BusinessActivityTerminator (com.arjuna.wst.BusinessActivityTerminator)6 TransactionRolledBackException (com.arjuna.wst.TransactionRolledBackException)2