use of org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType in project narayana by jbosstm.
the class Sc007TestCase method test3_3.
/**
* test3_3 - 3.3 VolatileAndDurable
* Tests registration during the volatile prepare phase.
* @throws Exception on failure.
*/
public void test3_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 = InteropUtil.createCoordinationContext(getSourceCoordinatorURI());
getParticipantStub().volatileAndDurable(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 org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType in project narayana by jbosstm.
the class Sc007TestCase method test3_2.
/**
* test3_2 - 3.2 Readonly
* Tests coordinator committing a transaction with a read only participant.
* @throws Exception on failure.
*/
public void test3_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 = InteropUtil.createCoordinationContext(getSourceCoordinatorURI());
getParticipantStub().readonly(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 org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType 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 org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType 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 org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType in project narayana by jbosstm.
the class EnduranceTest method doRegisterRequest.
public void doRegisterRequest(final String messageId) throws Exception {
final String protocolIdentifier = TestUtil.PROTOCOL_IDENTIFIER;
final W3CEndpointReference participantProtocolService = TestUtil11.getProtocolParticipantEndpoint("participant");
final CoordinationContextType coordinationContext = new CoordinationContextType();
CoordinationContextType.Identifier identifierInstance = new CoordinationContextType.Identifier();
coordinationContext.setCoordinationType(TestUtil.COORDINATION_TYPE);
coordinationContext.setIdentifier(identifierInstance);
identifierInstance.setValue("identifier");
coordinationContext.setRegistrationService(TestUtil11.getRegistrationEndpoint(identifierInstance.getValue()));
W3CEndpointReference coordinator = RegistrationCoordinator.register(coordinationContext, messageId, participantProtocolService, protocolIdentifier);
final RegisterDetails details = testRegistrationCoordinatorProcessor.getRegisterDetails(messageId, 10000);
final RegisterType requestRegister = details.getRegister();
final MAP requestMap = details.getMAP();
final ArjunaContext requestArjunaContext = details.getArjunaContext();
assertEquals(requestMap.getTo(), TestUtil11.registrationCoordinatorService);
assertEquals(requestMap.getMessageID(), messageId);
assertNotNull(requestArjunaContext);
assertEquals(requestArjunaContext.getInstanceIdentifier().getInstanceIdentifier(), identifierInstance.getValue());
assertEquals(protocolIdentifier, requestRegister.getProtocolIdentifier());
assertNotNull(protocolIdentifier, requestRegister.getParticipantProtocolService());
assertNotNull(coordinator);
}
Aggregations