use of org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext in project narayana by jbosstm.
the class EnduranceTest method doCreateCoordinationContextRequest.
public void doCreateCoordinationContextRequest(final String messageId) throws Exception {
final String coordinationType = TestUtil.COORDINATION_TYPE;
final MAP map = AddressingHelper.createRequestContext(TestUtil11.activationCoordinatorService, messageId);
CreateCoordinationContextResponseType response = ActivationCoordinatorClient.getClient().sendCreateCoordination(map, coordinationType, null, null);
final CreateCoordinationContextDetails details = testActivationCoordinatorProcessor.getCreateCoordinationContextDetails(messageId, 10000);
final CreateCoordinationContextType requestCreateCoordinationContext = details.getCreateCoordinationContext();
final MAP requestMap = details.getMAP();
assertEquals(requestMap.getTo(), TestUtil11.activationCoordinatorService);
assertEquals(requestMap.getMessageID(), messageId);
assertNull(requestCreateCoordinationContext.getExpires());
assertNull(requestCreateCoordinationContext.getCurrentContext());
assertEquals(requestCreateCoordinationContext.getCoordinationType(), coordinationType);
CoordinationContext context = response.getCoordinationContext();
assertNotNull(context);
assertNull(context.getExpires());
assertEquals(context.getCoordinationType(), coordinationType);
assertNotNull(context.getIdentifier());
}
use of org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext in project narayana by jbosstm.
the class RegistrationServiceTest method sendRegistration.
private W3CEndpointReference sendRegistration(String messageId, String protocolIdentifier) throws CannotRegisterException, InvalidStateException, InvalidProtocolException, SoapFault {
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 participantEndpoint = TestUtil11.getProtocolParticipantEndpoint("participant");
return RegistrationCoordinator.register(coordinationContext, messageId, participantEndpoint, protocolIdentifier);
}
use of org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext in project narayana by jbosstm.
the class TestActivationCoordinatorProcessor method createCoordinationContext.
public CreateCoordinationContextResponseType createCoordinationContext(final CreateCoordinationContextType createCoordinationContext, final MAP map, boolean isSecure) {
final String messageId = map.getMessageID();
synchronized (messageIdMap) {
messageIdMap.put(messageId, new CreateCoordinationContextDetails(createCoordinationContext, map));
messageIdMap.notifyAll();
}
String coordinationType = createCoordinationContext.getCoordinationType();
if (TestUtil.INVALID_CREATE_PARAMETERS_COORDINATION_TYPE.equals(coordinationType)) {
try {
SOAPFactory factory = SOAPFactory.newInstance();
SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_PARAMETERS_QNAME);
soapFault.addDetail().addDetailEntry(CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_PARAMETERS_QNAME).addTextNode("Invalid create parameters");
throw new SOAPFaultException(soapFault);
} catch (Throwable th) {
throw new ProtocolException(th);
}
}
// we have to return a value so lets cook one up
CreateCoordinationContextResponseType createCoordinationContextResponseType = new CreateCoordinationContextResponseType();
CoordinationContext coordinationContext = new CoordinationContext();
coordinationContext.setCoordinationType(coordinationType);
coordinationContext.setExpires(createCoordinationContext.getExpires());
String identifier = nextIdentifier();
CoordinationContextType.Identifier identifierInstance = new CoordinationContextType.Identifier();
identifierInstance.setValue(identifier);
coordinationContext.setIdentifier(identifierInstance);
W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
builder.serviceName(CoordinationConstants.REGISTRATION_SERVICE_QNAME);
builder.endpointName(CoordinationConstants.REGISTRATION_ENDPOINT_QNAME);
builder.address(TestUtil.PROTOCOL_COORDINATOR_SERVICE);
builder.build();
coordinationContext.setRegistrationService(TestUtil11.getRegistrationEndpoint(identifier));
createCoordinationContextResponseType.setCoordinationContext(coordinationContext);
return createCoordinationContextResponseType;
}
use of org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext in project narayana by jbosstm.
the class ActivationServiceTest method testKnownCoordinationType.
@Test
public void testKnownCoordinationType() throws Exception {
final String messageID = "testKnownCoordinationType";
final String coordinationTypeURI = TestUtil.COORDINATION_TYPE;
try {
final CoordinationContextType coordinationContext = ActivationCoordinator.createCoordinationContext(TestUtil11.activationCoordinatorService, messageID, coordinationTypeURI, null, null);
assertNotNull(coordinationContext);
assertNotNull(coordinationContext.getCoordinationType());
assertEquals(TestUtil.COORDINATION_TYPE, coordinationContext.getCoordinationType());
assertNotNull(coordinationContext.getRegistrationService());
} catch (final Throwable th) {
fail("Unexpected exception: " + th);
}
}
Aggregations