Search in sources :

Example 1 with BusinessActivityTerminator

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

the class BATestCase method testBA1_6.

/**
 * testBA1_6 - 1.6 CoordinatorCompleteClose
 * The PA successfully completes its work on behalf of the activity and the activity is closed.
 * @throws Exception on failure.
 */
public void testBA1_6() throws Exception {
    final String conversationId = getConversationId();
    final InteropWaitState state = new InteropWaitState(BusinessActivityConstants.WSBA_ACTION_CLOSED);
    ProxyConversation.setConversationState(conversationId, state);
    try {
        final String serviceURI = ProxyURIRewriting.rewriteURI(conversationId, getParticipantURI());
        final CoordinationContextType context = BAInteropUtil.createAtomicOutcomeCoordinationContext(getSourceCoordinatorURI());
        getParticipantStub().coordinatorCompleteClose(serviceURI, context);
        final BusinessActivityTerminator terminator = BAInteropUtil.registerTerminator(context, context.getIdentifier().getValue());
        terminator.complete();
        terminator.close();
        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 2 with BusinessActivityTerminator

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

the class BATestCase method testBA1_4.

/**
 * testBA1_4 - 1.4 CannotComplete
 * The PA sends CannotComplete before completing its work on behalf of the activity.
 * @throws Exception on failure.
 */
public void testBA1_4() throws Exception {
    final String conversationId = getConversationId();
    final InteropWaitState state = new InteropWaitState(BusinessActivityConstants.WSBA_ACTION_NOT_COMPLETED);
    ProxyConversation.setConversationState(conversationId, state);
    try {
        final String serviceURI = ProxyURIRewriting.rewriteURI(conversationId, getParticipantURI());
        final CoordinationContextType context = BAInteropUtil.createAtomicOutcomeCoordinationContext(getSourceCoordinatorURI());
        getParticipantStub().cannotComplete(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 3 with BusinessActivityTerminator

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

the class BATestCase method testBA1_8.

/**
 * testBA1_7 - 1.7 UnsolicitedComplete
 * Tests a protocol error, participant send Completed for coordinator completion.  Throws an invalid state fault.
 * @throws Exception on failure.
 *
 * this test relies on rewriting the protocol at registration time so that the returned endpoint
 * is for the coordinator completion coordinator rather than the participant completion coordinator.
 * the participant engine tries to use the endpoint to send an unsolicited complete to the coordinator
 * completion coordinator. unfortunately, since the endpoint nwo contains service and port metadata the
 * send fails. so this test has had to be decommissioned.
 */
/*
    public void testBA1_7()
        throws Exception
    {
        final String conversationId = getConversationId() ;
        final BAInteropUnsolicitedCompleteState state = new BAInteropUnsolicitedCompleteState() ;
        ProxyConversation.setConversationState(conversationId, state) ;
        try
        {
            final String serviceURI = ProxyURIRewriting.rewriteURI(conversationId, getParticipantURI()) ;
            final CoordinationContextType context = BAInteropUtil.createAtomicOutcomeCoordinationContext(getSourceCoordinatorURI()) ;
            getParticipantStub().unsolicitedComplete(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()) ;
    }
    */
// 
/**
 * testBA1_8 - 1.8 Compensate
 * The PA successfully completes its work on behalf of the activity and the activity is compensated.
 * @throws Exception on failure.
 */
public void testBA1_8() throws Exception {
    final String conversationId = getConversationId();
    final BAInteropParticipantCompletedState state = new BAInteropParticipantCompletedState(BusinessActivityConstants.WSBA_ACTION_COMPENSATED);
    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.cancel();
        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 4 with BusinessActivityTerminator

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

the class BATestCase method testBA1_3.

/**
 * testBA1_3 - 1.3 Fail
 * The PA fails before completing its work on behalf of the activity.
 * @throws Exception on failure.
 */
public void testBA1_3() throws Exception {
    final String conversationId = getConversationId();
    final InteropWaitState state = new InteropWaitState(BusinessActivityConstants.WSBA_ACTION_FAILED);
    ProxyConversation.setConversationState(conversationId, state);
    try {
        final String serviceURI = ProxyURIRewriting.rewriteURI(conversationId, getParticipantURI());
        final CoordinationContextType context = BAInteropUtil.createAtomicOutcomeCoordinationContext(getSourceCoordinatorURI());
        getParticipantStub().fail(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 5 with BusinessActivityTerminator

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

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