Search in sources :

Example 6 with BusinessActivityTerminator

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

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

the class BATestCase method testBA1_9.

/**
 * testBA1_9 - 1.9 CompensationFail
 * The PA successfully completes its work on behalf of the activity but compensation fails..
 * @throws Exception on failure.
 */
public void testBA1_9() throws Exception {
    final String conversationId = getConversationId();
    final BAInteropParticipantCompletedState state = new BAInteropParticipantCompletedState(BusinessActivityConstants.WSBA_ACTION_FAILED);
    ProxyConversation.setConversationState(conversationId, state);
    try {
        final String serviceURI = ProxyURIRewriting.rewriteURI(conversationId, getParticipantURI());
        final CoordinationContextType context = BAInteropUtil.createAtomicOutcomeCoordinationContext(getSourceCoordinatorURI());
        getParticipantStub().compensationFail(serviceURI, context);
        assertTrue("Participant did not issue Completed", state.waitForParticipantCompleted(getTestTimeout()));
        final BusinessActivityTerminator terminator = BAInteropUtil.registerTerminator(context, context.getIdentifier().getValue());
        terminator.cancel();
        state.waitForCompletion(getTestTimeout());
    } finally {
        ProxyConversation.clearConversationState(conversationId);
    }
    assertTrue("Conversation did not complete successfully", state.isSuccessful());
}
Also used : BusinessActivityTerminator(com.arjuna.wst.BusinessActivityTerminator) BAInteropParticipantCompletedState(com.jboss.transaction.txinterop.interop.states.BAInteropParticipantCompletedState) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)

Example 8 with BusinessActivityTerminator

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

Example 9 with BusinessActivityTerminator

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

the class BATestCase method testBA1_5.

/**
 * testBA1_5 - 1.5 ParticipantCompleteClose
 * The PA successfully completes its work on behalf of the activity and the activity is closed.
 * @throws Exception on failure.
 */
public void testBA1_5() throws Exception {
    final String conversationId = getConversationId();
    final BAInteropParticipantCompletedState state = new BAInteropParticipantCompletedState(BusinessActivityConstants.WSBA_ACTION_CLOSED);
    ProxyConversation.setConversationState(conversationId, state);
    try {
        final String serviceURI = ProxyURIRewriting.rewriteURI(conversationId, getParticipantURI());
        final CoordinationContextType context = BAInteropUtil.createAtomicOutcomeCoordinationContext(getSourceCoordinatorURI());
        getParticipantStub().participantCompleteClose(serviceURI, context);
        assertTrue("Participant did not issue Completed", state.waitForParticipantCompleted(getTestTimeout()));
        final BusinessActivityTerminator terminator = BAInteropUtil.registerTerminator(context, context.getIdentifier().getValue());
        terminator.close();
        state.waitForCompletion(0);
    } finally {
        ProxyConversation.clearConversationState(conversationId);
    }
    assertTrue("Conversation did not complete successfully", state.isSuccessful());
}
Also used : BusinessActivityTerminator(com.arjuna.wst.BusinessActivityTerminator) BAInteropParticipantCompletedState(com.jboss.transaction.txinterop.interop.states.BAInteropParticipantCompletedState) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)

Example 10 with BusinessActivityTerminator

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

the class BATestCase method testBA1_10.

/**
 * testBA1_10 - 1.10 ParticipantCancelCompletedRace
 * Simulate a race between cancel and completed.
 * @throws Exception on failure.
 */
public void testBA1_10() throws Exception {
    final String conversationId = getConversationId();
    final BAInteropDroppedParticipantCompletedState state = new BAInteropDroppedParticipantCompletedState(BusinessActivityConstants.WSBA_ACTION_COMPENSATED);
    ProxyConversation.setConversationState(conversationId, state);
    try {
        final String serviceURI = ProxyURIRewriting.rewriteURI(conversationId, getParticipantURI());
        final CoordinationContextType context = BAInteropUtil.createAtomicOutcomeCoordinationContext(getSourceCoordinatorURI());
        getParticipantStub().participantCancelCompletedRace(serviceURI, context);
        assertTrue("Participant did not issue Completed", state.waitForParticipantCompleted(getTestTimeout()));
        final BusinessActivityTerminator terminator = BAInteropUtil.registerTerminator(context, context.getIdentifier().getValue());
        terminator.cancel();
        state.waitForCompletion(getTestTimeout());
    } finally {
        ProxyConversation.clearConversationState(conversationId);
    }
    assertTrue("Conversation did not complete successfully", state.isSuccessful());
}
Also used : BAInteropDroppedParticipantCompletedState(com.jboss.transaction.txinterop.interop.states.BAInteropDroppedParticipantCompletedState) BusinessActivityTerminator(com.arjuna.wst.BusinessActivityTerminator) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)

Aggregations

BusinessActivityTerminator (com.arjuna.wst.BusinessActivityTerminator)10 CoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)10 InteropWaitState (com.jboss.transaction.txinterop.interop.states.InteropWaitState)6 BAInteropParticipantCompletedState (com.jboss.transaction.txinterop.interop.states.BAInteropParticipantCompletedState)3 BAInteropDroppedParticipantCompletedState (com.jboss.transaction.txinterop.interop.states.BAInteropDroppedParticipantCompletedState)1