use of org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext in project narayana by jbosstm.
the class ActivationTest method testRequestWithExpiresWithoutCurrentContext.
@Test
public void testRequestWithExpiresWithoutCurrentContext() throws Exception {
final String messageId = "testRequestWithExpiresWithoutCurrentContext";
final String coordinationType = TestUtil.COORDINATION_TYPE;
final Long expires = new Long(123456L);
final CoordinationContext coordinationContext = null;
executeRequestTest(messageId, coordinationType, expires, coordinationContext);
}
use of org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext 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);
}
use of org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext in project narayana by jbosstm.
the class EnduranceTest method doRegisterError.
public void doRegisterError(final String messageId, int count) throws Exception {
final String protocolIdentifier;
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 = null;
switch(count) {
case 0:
protocolIdentifier = TestUtil.INVALID_PROTOCOL_PROTOCOL_IDENTIFIER;
try {
coordinator = RegistrationCoordinator.register(coordinationContext, messageId, participantProtocolService, protocolIdentifier);
} catch (InvalidProtocolException ipe) {
}
if (coordinator != null) {
fail("expected invalid protocol exception");
}
break;
case 1:
protocolIdentifier = TestUtil.INVALID_STATE_PROTOCOL_IDENTIFIER;
try {
coordinator = RegistrationCoordinator.register(coordinationContext, messageId, participantProtocolService, protocolIdentifier);
} catch (InvalidStateException ise) {
}
if (coordinator != null) {
fail("expected invalid state exception");
}
break;
case 3:
protocolIdentifier = TestUtil.NO_ACTIVITY_PROTOCOL_IDENTIFIER;
try {
coordinator = RegistrationCoordinator.register(coordinationContext, messageId, participantProtocolService, protocolIdentifier);
} catch (CannotRegisterException cre) {
}
if (coordinator != null) {
fail("expected cannot register exception");
}
break;
default:
protocolIdentifier = TestUtil.ALREADY_REGISTERED_PROTOCOL_IDENTIFIER;
try {
coordinator = RegistrationCoordinator.register(coordinationContext, messageId, participantProtocolService, protocolIdentifier);
} catch (CannotRegisterException cre) {
}
if (coordinator != null) {
fail("expected cannot register exception");
}
break;
}
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());
}
use of org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext in project narayana by jbosstm.
the class TestContextFactory method create.
public CoordinationContext create(final String coordinationTypeURI, final Long expires, final CoordinationContextType currentContext, boolean isSecure) throws InvalidCreateParametersException {
if (coordinationTypeURI.equals(TestUtil.INVALID_CREATE_PARAMETERS_COORDINATION_TYPE)) {
throw new InvalidCreateParametersException();
}
final ServiceRegistry serviceRegistry = ServiceRegistry.getRegistry();
final String registrationURI = serviceRegistry.getServiceURI(CoordinationConstants.REGISTRATION_SERVICE_NAME);
final W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
builder.serviceName(CoordinationConstants.REGISTRATION_SERVICE_QNAME);
builder.endpointName(CoordinationConstants.REGISTRATION_ENDPOINT_QNAME);
builder.address(registrationURI);
W3CEndpointReference registrationService = builder.build();
CoordinationContext testCoordinationContext = new CoordinationContext();
CoordinationContext.Identifier identifier = new CoordinationContext.Identifier();
identifier.setValue(Integer.toString(nextIdentifier()));
testCoordinationContext.setIdentifier(identifier);
if (expires != null && expires.longValue() > 0) {
Expires expiresInstance = new Expires();
expiresInstance.setValue(expires);
testCoordinationContext.setExpires(expiresInstance);
}
testCoordinationContext.setCoordinationType(_coordinationType);
testCoordinationContext.setRegistrationService(registrationService);
try {
SOAPFactory factory = SOAPFactory.newInstance();
SOAPElement element = factory.createElement(TestUtil.TEST_ELEMENT_EXTENSION_VALUE_QNAME);
element.addTextNode(TestUtil.TEST_EXTENSION_VALUE);
testCoordinationContext.getAny().add(element);
} catch (SOAPException e) {
// TODO log error here
}
return testCoordinationContext;
}
use of org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext in project narayana by jbosstm.
the class ParticipantPortTypeImpl method commit.
/**
*/
@WebMethod(operationName = "Commit", action = "http://fabrikam123.com/Commit")
@Oneway
@Action(input = "http://fabrikam123.com/Commit")
@RequestWrapper(localName = "Commit", targetNamespace = "http://fabrikam123.com", className = "com.jboss.transaction.txinterop.webservices.atinterop.generated.TestMessageType")
public void commit() {
MessageContext ctx = webServiceCtx.getMessageContext();
MAP inboundMap = AddressingHelper.inboundMap(ctx);
CoordinationContextType coordinationContext = CoordinationContextManager.getContext(ctx);
try {
ATParticipantProcessor.getParticipant().commit(coordinationContext, inboundMap);
} catch (SoapFault11 sf) {
sendSoapFault(inboundMap, sf);
return;
}
sendResponse(inboundMap);
}
Aggregations