use of com.jboss.transaction.txinterop.interop.states.InteropWaitState 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());
}
use of com.jboss.transaction.txinterop.interop.states.InteropWaitState in project narayana by jbosstm.
the class ATTestCase method testAT2_1.
/**
* testAT2_1 - 2.1 Commit
* Participant registers for Durable2PC, initiator commits, transaction commits successfully.
* @throws Exception on failure.
*/
public void testAT2_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 CoordinationContextType context = ATInteropUtil.createCoordinationContext(getSourceCoordinatorURI());
getParticipantStub().commit(serviceURI, context);
final CompletionCoordinatorParticipant participant = ATInteropUtil.registerCompletion(context, context.getIdentifier().getValue());
participant.commit();
state.waitForCompletion(0);
} finally {
ProxyConversation.clearConversationState(conversationId);
}
assertTrue("Conversation did not complete successfully", state.isSuccessful());
}
use of com.jboss.transaction.txinterop.interop.states.InteropWaitState in project narayana by jbosstm.
the class ATTestCase method testAT3_3.
/**
* testAT3_3 - 3.3 VolatileAndDurable
* Tests registration during the volatile prepare phase.
* @throws Exception on failure.
*/
public void testAT3_3() 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 = ATInteropUtil.createCoordinationContext(getSourceCoordinatorURI());
getParticipantStub().volatileAndDurable(serviceURI, context);
final CompletionCoordinatorParticipant participant = ATInteropUtil.registerCompletion(context, context.getIdentifier().getValue());
participant.commit();
state.waitForCompletion(0);
} finally {
ProxyConversation.clearConversationState(conversationId);
}
assertTrue("Conversation did not complete successfully", state.isSuccessful());
}
use of com.jboss.transaction.txinterop.interop.states.InteropWaitState in project narayana by jbosstm.
the class ATTestCase method testAT4_2.
/**
* testAT4_2 - 4.2 EarlyAborted
* Tests the case of a participant initiated Aborted message occurring prior to the prepare phase.
* @throws Exception on failure.
*/
public void testAT4_2() throws Exception {
final String conversationId = getConversationId();
final InteropWaitState state = new InteropWaitState(AtomicTransactionConstants.WSAT_ACTION_ABORTED, 2);
ProxyConversation.setConversationState(conversationId, state);
try {
final String serviceURI = ProxyURIRewriting.rewriteURI(conversationId, getParticipantURI());
final CoordinationContextType context = ATInteropUtil.createCoordinationContext(getSourceCoordinatorURI());
getParticipantStub().earlyAborted(serviceURI, context);
final CompletionCoordinatorParticipant participant = ATInteropUtil.registerCompletion(context, context.getIdentifier().getValue());
participant.commit();
fail("Transaction rollback expected");
} catch (final TransactionRolledBackException trbe) {
state.waitForCompletion(0);
} finally {
ProxyConversation.clearConversationState(conversationId);
}
assertTrue("Conversation did not complete successfully", state.isSuccessful());
}
use of com.jboss.transaction.txinterop.interop.states.InteropWaitState in project narayana by jbosstm.
the class ATTestCase method testAT1_1.
/**
* testAT1_1 - 1.1 CompletionCommit
* Participant creates and commits a transaction using the initiator's coordinator.
* @throws Exception on failure.
*/
public void testAT1_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());
}
Aggregations