use of com.arjuna.wst.CompletionCoordinatorParticipant in project narayana by jbosstm.
the class Sc007TestCase method test2_1.
/**
* testAT2_1 - 2.1 Commit
* Participant registers for Durable2PC, initiator commits, transaction commits successfully.
* @throws Exception on failure.
*/
public void test2_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 = InteropUtil.createCoordinationContext(getSourceCoordinatorURI());
getParticipantStub().commit(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());
}
use of com.arjuna.wst.CompletionCoordinatorParticipant in project narayana by jbosstm.
the class Sc007TestCase method test3_7.
/**
* test3_7 - 3.7 RetryPreparedCommit
* Tests recovery from a communication failure during the prepare phase. Transaction commits normally.
* @throws Exception on failure.
*/
public void test3_7() throws Exception {
final String conversationId = getConversationId();
final Sc007RetryPreparedCommitState state = new Sc007RetryPreparedCommitState();
ProxyConversation.setConversationState(conversationId, state);
try {
final String serviceURI = ProxyURIRewriting.rewriteURI(conversationId, getParticipantURI());
final CoordinationContextType context = InteropUtil.createCoordinationContext(getSourceCoordinatorURI());
getParticipantStub().retryPreparedCommit(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());
}
use of com.arjuna.wst.CompletionCoordinatorParticipant in project narayana by jbosstm.
the class ParticipantProcessor method completionCommit.
/**
* Execute the CompletionCommit
* @param coordinatorURI The address of the coordinator to employ
* @param map The current addressing context.
* @throws SoapFault11 for errors during processing
*/
public void completionCommit(final String coordinatorURI, final MAP map) throws SoapFault11 {
try {
final CoordinationContextType context = InteropUtil.createCoordinationContext(coordinatorURI);
final CompletionCoordinatorParticipant participant = InteropUtil.registerCompletion(context, context.getIdentifier().getValue());
participant.commit();
} catch (final Throwable th) {
throw new SoapFault11(th);
}
}
use of com.arjuna.wst.CompletionCoordinatorParticipant in project narayana by jbosstm.
the class ATTestCase method testAT3_1.
/**
* testAT3_1 - 3.1 Phase2Rollback
* Coordinator aborts the transaction due to an Aborted vote during the prepare phase.
* @throws Exception on failure.
*/
public void testAT3_1() 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().phase2Rollback(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.arjuna.wst.CompletionCoordinatorParticipant in project narayana by jbosstm.
the class ATTestCase method testAT3_2.
/**
* testAT3_2 - 3.2 Readonly
* Tests coordinator committing a transaction with a read only participant.
* @throws Exception on failure.
*/
public void testAT3_2() 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().readonly(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());
}
Aggregations