Search in sources :

Example 76 with CoordinationContext

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());
}
Also used : CreateCoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CreateCoordinationContextType) CreateCoordinationContextDetails(com.arjuna.wsc.tests.arq.TestActivationCoordinatorProcessor.CreateCoordinationContextDetails) MAP(org.jboss.ws.api.addressing.MAP) CreateCoordinationContextResponseType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CreateCoordinationContextResponseType) CoordinationContext(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext)

Example 77 with CoordinationContext

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);
}
Also used : W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)

Example 78 with CoordinationContext

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;
}
Also used : ProtocolException(javax.xml.ws.ProtocolException) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) SOAPFactory(javax.xml.soap.SOAPFactory) CoordinationContext(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext) W3CEndpointReferenceBuilder(javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder) SOAPFault(javax.xml.soap.SOAPFault) CreateCoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CreateCoordinationContextType) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) CreateCoordinationContextResponseType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CreateCoordinationContextResponseType)

Example 79 with CoordinationContext

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);
    }
}
Also used : CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) Test(org.junit.Test)

Aggregations

CoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)69 MAP (org.jboss.ws.api.addressing.MAP)43 SoapFault11 (com.arjuna.webservices11.SoapFault11)39 Action (javax.xml.ws.Action)38 RequestWrapper (javax.xml.ws.RequestWrapper)38 MessageContext (javax.xml.ws.handler.MessageContext)38 CoordinationContext (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext)24 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)14 InvalidCreateParametersException (com.arjuna.wsc.InvalidCreateParametersException)12 CreateCoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CreateCoordinationContextType)9 Expires (org.oasis_open.docs.ws_tx.wscoor._2006._06.Expires)9 Test (org.junit.Test)7 SoapFault (com.arjuna.webservices.SoapFault)6 InvalidProtocolException (com.arjuna.wsc.InvalidProtocolException)6 SystemException (com.arjuna.wst.SystemException)6 TxContextImple (com.arjuna.mwlabs.wst11.at.context.TxContextImple)5 ServiceRegistry (com.arjuna.webservices11.ServiceRegistry)5 SOAPEnvelope (javax.xml.soap.SOAPEnvelope)5 SOAPHeaderElement (javax.xml.soap.SOAPHeaderElement)5 ProtocolException (javax.xml.ws.ProtocolException)5