Search in sources :

Example 6 with InstanceIdentifier

use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.

the class RegistrarImple method getCompletionCoordinator.

private W3CEndpointReference getCompletionCoordinator(final InstanceIdentifier instanceIdentifier, final boolean isSecure) {
    W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
    ServiceRegistry serviceRegistry = PrivilegedServiceRegistryFactory.getInstance().getServiceRegistry();
    String address = serviceRegistry.getServiceURI(AtomicTransactionConstants.COMPLETION_COORDINATOR_SERVICE_NAME, isSecure);
    builder.serviceName(AtomicTransactionConstants.COMPLETION_COORDINATOR_SERVICE_QNAME);
    builder.endpointName(AtomicTransactionConstants.COMPLETION_COORDINATOR_PORT_QNAME);
    builder.address(address);
    InstanceIdentifier.setEndpointInstanceIdentifier(builder, instanceIdentifier);
    return builder.build();
}
Also used : W3CEndpointReferenceBuilder(javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder) ServiceRegistry(com.arjuna.webservices11.ServiceRegistry)

Example 7 with InstanceIdentifier

use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.

the class BusinessAgreementWithCoordinatorCompletionCoordinatorTest method testSendCancel.

@Test
public void testSendCancel() throws Exception {
    final String messageId = "testSendCancel";
    final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("2");
    W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionParticipantEndpoint(instanceIdentifier.getInstanceIdentifier());
    final MAP map = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionParticipantServiceURI, messageId);
    CoordinatorCompletionParticipantClient.getClient().sendCancel(endpoint, map, new InstanceIdentifier("sender"));
    final CoordinatorCompletionParticipantDetails details = testCoordinatorCompletionParticipantProcessor.getCoordinatorCompletionParticipantDetails(messageId, 10000);
    assertTrue(details.hasCancel());
    checkDetails(details, true, true, messageId, instanceIdentifier);
}
Also used : W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) CoordinatorCompletionParticipantDetails(com.arjuna.wst.tests.arq.TestCoordinatorCompletionParticipantProcessor.CoordinatorCompletionParticipantDetails) MAP(org.jboss.ws.api.addressing.MAP) Test(org.junit.Test)

Example 8 with InstanceIdentifier

use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.

the class BusinessAgreementWithCoordinatorCompletionCoordinatorTest method checkDetails.

/**
 * check the message details to see that they have the correct to and from address and message id, a null
 * reply to address and an arjuna context containing the correct instannce identifier
 * @param details
 * @param messageId
 * @param instanceIdentifier
 */
private void checkDetails(CoordinatorCompletionParticipantDetails details, boolean hasFrom, boolean hasFaultTo, String messageId, InstanceIdentifier instanceIdentifier) {
    MAP inMAP = details.getMAP();
    ArjunaContext inArjunaContext = details.getArjunaContext();
    assertEquals(inMAP.getTo(), TestUtil.coordinatorCompletionParticipantServiceURI);
    assertNotNull(inMAP.getReplyTo());
    assertTrue(AddressingHelper.isNoneReplyTo(inMAP));
    if (hasFrom) {
        assertNotNull(inMAP.getFrom());
        assertEquals(inMAP.getFrom().getAddress(), TestUtil.coordinatorCompletionCoordinatorServiceURI);
    } else {
        assertNull(inMAP.getFrom());
    }
    if (hasFaultTo) {
        assertNotNull(inMAP.getFaultTo());
        assertEquals(inMAP.getFaultTo().getAddress(), TestUtil.coordinatorCompletionCoordinatorServiceURI);
    } else {
        assertNull(inMAP.getFrom());
    }
    assertNotNull(inMAP.getMessageID());
    assertEquals(inMAP.getMessageID(), messageId);
    if (instanceIdentifier == null) {
        assertNull(inArjunaContext);
    } else {
        assertNotNull(inArjunaContext);
        assertEquals(instanceIdentifier.getInstanceIdentifier(), inArjunaContext.getInstanceIdentifier().getInstanceIdentifier());
    }
}
Also used : ArjunaContext(com.arjuna.webservices11.wsarj.ArjunaContext) MAP(org.jboss.ws.api.addressing.MAP)

Example 9 with InstanceIdentifier

use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.

the class BusinessAgreementWithCoordinatorCompletionCoordinatorTest method testSendError.

@Test
public void testSendError() throws Exception {
    final String messageId = "testSendError";
    final MAP map = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionParticipantServiceURI, messageId);
    final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("9");
    final String reason = "testSendErrorReason";
    final SoapFaultType soapFaultType = SoapFaultType.FAULT_SENDER;
    final QName subcode = ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME;
    final SoapFault11 soapFault = new SoapFault11(soapFaultType, subcode, reason);
    // this would be a better test if we could set the identifier as a reference parameter here
    CoordinatorCompletionParticipantClient.getClient().sendSoapFault(soapFault, null, map, TestUtil.getBusinessActivityFaultAction());
    final CoordinatorCompletionParticipantDetails details = testCoordinatorCompletionParticipantProcessor.getCoordinatorCompletionParticipantDetails(messageId, 10000);
    assertNotNull(details.hasSoapFault());
    assertEquals(details.hasSoapFault().getSoapFaultType(), soapFaultType);
    assertEquals(details.hasSoapFault().getReason(), reason);
    assertEquals(details.hasSoapFault().getSubcode(), subcode);
    checkDetails(details, false, false, messageId, null);
}
Also used : SoapFaultType(com.arjuna.webservices.SoapFaultType) QName(javax.xml.namespace.QName) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) SoapFault11(com.arjuna.webservices11.SoapFault11) CoordinatorCompletionParticipantDetails(com.arjuna.wst.tests.arq.TestCoordinatorCompletionParticipantProcessor.CoordinatorCompletionParticipantDetails) MAP(org.jboss.ws.api.addressing.MAP) Test(org.junit.Test)

Example 10 with InstanceIdentifier

use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.

the class BusinessAgreementWithCoordinatorCompletionCoordinatorTest method testSendClose.

@Test
public void testSendClose() throws Exception {
    final String messageId = "testSendClose";
    final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("1");
    W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionParticipantEndpoint(instanceIdentifier.getInstanceIdentifier());
    final MAP map = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionParticipantServiceURI, messageId);
    CoordinatorCompletionParticipantClient.getClient().sendClose(endpoint, map, new InstanceIdentifier("sender"));
    final CoordinatorCompletionParticipantDetails details = testCoordinatorCompletionParticipantProcessor.getCoordinatorCompletionParticipantDetails(messageId, 10000);
    assertTrue(details.hasClose());
    checkDetails(details, true, true, messageId, instanceIdentifier);
}
Also used : W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) CoordinatorCompletionParticipantDetails(com.arjuna.wst.tests.arq.TestCoordinatorCompletionParticipantProcessor.CoordinatorCompletionParticipantDetails) MAP(org.jboss.ws.api.addressing.MAP) Test(org.junit.Test)

Aggregations

InstanceIdentifier (com.arjuna.webservices11.wsarj.InstanceIdentifier)130 MAP (org.jboss.ws.api.addressing.MAP)83 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)53 Test (org.junit.Test)51 SoapFault11 (com.arjuna.webservices11.SoapFault11)24 SoapFault (com.arjuna.webservices.SoapFault)20 ArjunaContext (com.arjuna.webservices11.wsarj.ArjunaContext)13 SystemException (com.arjuna.wst.SystemException)13 UnknownTransactionException (com.arjuna.wst.UnknownTransactionException)13 QName (javax.xml.namespace.QName)12 CoordinatorCompletionCoordinatorInboundEvents (com.arjuna.webservices11.wsba.CoordinatorCompletionCoordinatorInboundEvents)10 CoordinatorCompletionParticipantInboundEvents (com.arjuna.webservices11.wsba.CoordinatorCompletionParticipantInboundEvents)10 ParticipantCompletionCoordinatorInboundEvents (com.arjuna.webservices11.wsba.ParticipantCompletionCoordinatorInboundEvents)10 CoordinatorCompletionParticipantDetails (com.arjuna.wst.tests.arq.TestCoordinatorCompletionParticipantProcessor.CoordinatorCompletionParticipantDetails)10 ParticipantCompletionCoordinatorDetails (com.arjuna.wst.tests.arq.TestParticipantCompletionCoordinatorProcessor.ParticipantCompletionCoordinatorDetails)10 SoapFaultType (com.arjuna.webservices.SoapFaultType)9 ParticipantCompletionParticipantInboundEvents (com.arjuna.webservices11.wsba.ParticipantCompletionParticipantInboundEvents)9 CoordinatorCompletionCoordinatorDetails (com.arjuna.wst.tests.arq.TestCoordinatorCompletionCoordinatorProcessor.CoordinatorCompletionCoordinatorDetails)9 ParticipantCompletionParticipantDetails (com.arjuna.wst.tests.arq.TestParticipantCompletionParticipantProcessor.ParticipantCompletionParticipantDetails)9 ProtocolException (javax.xml.ws.ProtocolException)9