Search in sources :

Example 1 with BAInteropParticipantCompletedState

use of com.jboss.transaction.txinterop.interop.states.BAInteropParticipantCompletedState 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 2 with BAInteropParticipantCompletedState

use of com.jboss.transaction.txinterop.interop.states.BAInteropParticipantCompletedState 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 3 with BAInteropParticipantCompletedState

use of com.jboss.transaction.txinterop.interop.states.BAInteropParticipantCompletedState 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)

Aggregations

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