Search in sources :

Example 11 with InteropWaitState

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

the class Sc007TestCase method test1_1.

/**
 * test1_1 - 1.1 CompletionCommit
 * Participant creates and commits a transaction using the initiator's coordinator.
 * @throws Exception on failure.
 */
public void test1_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 String coordinatorURI = ProxyURIRewriting.rewriteURI(ProxyConversation.getAlternateConversationId(conversationId), getSourceCoordinatorURI());
        getParticipantStub().completionCommit(serviceURI, coordinatorURI);
        state.waitForCompletion(getTestTimeout());
    } finally {
        ProxyConversation.clearConversationState(conversationId);
    }
    assertTrue("Conversation did not complete successfully", state.isSuccessful());
}
Also used : InteropWaitState(com.jboss.transaction.wstf.interop.states.InteropWaitState)

Example 12 with InteropWaitState

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

the class Sc007TestCase method test3_6.

/**
 * test3_6 - 3.6 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 test3_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 = InteropUtil.createCoordinationContext(getSourceCoordinatorURI());
        getParticipantStub().replayCommit(serviceURI, context);
        final CompletionCoordinatorParticipant participant = InteropUtil.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.wstf.interop.states.InteropWaitState) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) CompletionCoordinatorParticipant(com.arjuna.wst.CompletionCoordinatorParticipant)

Aggregations

InteropWaitState (com.jboss.transaction.wstf.interop.states.InteropWaitState)12 CompletionCoordinatorParticipant (com.arjuna.wst.CompletionCoordinatorParticipant)10 CoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)10 TransactionRolledBackException (com.arjuna.wst.TransactionRolledBackException)2