Search in sources :

Example 1 with SoapFaultType

use of com.arjuna.webservices.SoapFaultType 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 2 with SoapFaultType

use of com.arjuna.webservices.SoapFaultType in project narayana by jbosstm.

the class BusinessAgreementWithParticipantCompletionCoordinatorTest method testSendError.

@Test
public void testSendError() throws Exception {
    final String messageId = "testSendGetStatus";
    final MAP map = AddressingHelper.createRequestContext(TestUtil.participantCompletionParticipantServiceURI, messageId);
    final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("8");
    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);
    ParticipantCompletionParticipantClient.getClient().sendSoapFault(soapFault, null, map, TestUtil.getBusinessActivityFaultAction());
    final ParticipantCompletionParticipantDetails details = testParticipantCompletionParticipantProcessor.getParticipantCompletionParticipantDetails(messageId, 10000);
    assertNotNull(details.getSoapFault());
    assertEquals(details.getSoapFault().getSoapFaultType(), soapFault.getSoapFaultType());
    assertEquals(details.getSoapFault().getReason(), soapFault.getReason());
    assertEquals(details.getSoapFault().getSubcode(), soapFault.getSubcode());
    checkDetails(details, false, false, messageId, null);
}
Also used : SoapFaultType(com.arjuna.webservices.SoapFaultType) ParticipantCompletionParticipantDetails(com.arjuna.wst.tests.arq.TestParticipantCompletionParticipantProcessor.ParticipantCompletionParticipantDetails) QName(javax.xml.namespace.QName) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) SoapFault11(com.arjuna.webservices11.SoapFault11) MAP(org.jboss.ws.api.addressing.MAP) Test(org.junit.Test)

Example 3 with SoapFaultType

use of com.arjuna.webservices.SoapFaultType in project narayana by jbosstm.

the class CompletionCoordinatorTest method testSendError.

@Test
public void testSendError() throws Exception {
    final String messageId = "123456";
    final String reason = "testSendErrorReason";
    final String instanceIdentifier = "testSendError";
    final W3CEndpointReference completionInitiatorEndpoint = TestUtil.getCompletionInitiatorEndpoint(instanceIdentifier);
    final MAP map = AddressingHelper.createRequestContext(TestUtil.completionInitiatorServiceURI, messageId);
    final SoapFaultType soapFaultType = SoapFaultType.FAULT_SENDER;
    final QName subcode = ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME;
    final SoapFault soapFault = new SoapFault11(soapFaultType, subcode, reason);
    final TestCompletionInitiatorCallback callback = new TestCompletionInitiatorCallback() {

        public void soapFault(final SoapFault soapFault, final MAP map, final ArjunaContext arjunaContext) {
            assertEquals(map.getTo(), TestUtil.completionInitiatorServiceURI);
            assertNull(map.getFrom());
            assertNull(map.getFaultTo());
            assertNotNull(map.getReplyTo());
            assertTrue(AddressingHelper.isNoneReplyTo(map));
            assertNotNull(map.getMessageID());
            assertEquals(map.getMessageID(), messageId);
            assertNotNull(arjunaContext);
            assertEquals(instanceIdentifier, arjunaContext.getInstanceIdentifier().getInstanceIdentifier());
            assertNotNull(soapFault);
            assertEquals(soapFaultType, soapFault.getSoapFaultType());
            assertEquals(subcode, soapFault.getSubcode());
            assertEquals(reason, soapFault.getReason());
        }
    };
    final CompletionInitiatorProcessor initiator = CompletionInitiatorProcessor.getProcessor();
    initiator.registerCallback(instanceIdentifier, callback);
    try {
        CompletionInitiatorClient.getClient().sendSoapFault(completionInitiatorEndpoint, map, soapFault, new InstanceIdentifier("sender"));
        callback.waitUntilTriggered();
    } finally {
        initiator.removeCallback(instanceIdentifier);
    }
    assertTrue(callback.hasTriggered());
    assertFalse(callback.hasFailed());
}
Also used : SoapFault(com.arjuna.webservices.SoapFault) SoapFaultType(com.arjuna.webservices.SoapFaultType) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) QName(javax.xml.namespace.QName) CompletionInitiatorProcessor(com.arjuna.webservices11.wsat.processors.CompletionInitiatorProcessor) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) SoapFault11(com.arjuna.webservices11.SoapFault11) ArjunaContext(com.arjuna.webservices11.wsarj.ArjunaContext) MAP(org.jboss.ws.api.addressing.MAP) Test(org.junit.Test)

Example 4 with SoapFaultType

use of com.arjuna.webservices.SoapFaultType in project narayana by jbosstm.

the class TwoPCCoordinatorTest method testSendError.

@Test
public void testSendError() throws Exception {
    final String messageId = "testSendError";
    final MAP map = AddressingHelper.createRequestContext(TestUtil.participantServiceURI, messageId);
    final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("4");
    final String reason = "testSendErrorReason";
    final SoapFaultType soapFaultType = SoapFaultType.FAULT_SENDER;
    final QName subcode = ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME;
    final SoapFault soapFault = new SoapFault11(soapFaultType, subcode, reason);
    ParticipantClient.getClient().sendSoapFault(map, soapFault, new InstanceIdentifier("sender"));
    final ParticipantDetails details = testParticipantProcessor.getParticipantDetails(messageId, 10000);
    final SoapFault receivedSoapFault = details.getSoapFault();
    assertNotNull(receivedSoapFault);
    assertEquals(soapFaultType, receivedSoapFault.getSoapFaultType());
    assertEquals(subcode, receivedSoapFault.getSubcode());
    assertEquals(reason, receivedSoapFault.getReason());
    checkDetails(details, false, false, messageId, null);
}
Also used : SoapFault(com.arjuna.webservices.SoapFault) SoapFaultType(com.arjuna.webservices.SoapFaultType) QName(javax.xml.namespace.QName) ParticipantDetails(com.arjuna.wst.tests.arq.TestParticipantProcessor.ParticipantDetails) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) SoapFault11(com.arjuna.webservices11.SoapFault11) MAP(org.jboss.ws.api.addressing.MAP) Test(org.junit.Test)

Example 5 with SoapFaultType

use of com.arjuna.webservices.SoapFaultType in project narayana by jbosstm.

the class BusinessAgreementWithCoordinatorCompletionParticipantTest method testSendError.

@Test
public void testSendError() throws Exception {
    final String messageId = "testSendError";
    final MAP map = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionCoordinatorServiceURI, messageId);
    final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("7");
    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
    CoordinatorCompletionCoordinatorClient.getClient().sendSoapFault(soapFault, null, map, TestUtil.getBusinessActivityFaultAction());
    final CoordinatorCompletionCoordinatorDetails details = testCoordinatorCompletionCoordinatorProcessor.getCoordinatorCompletionCoordinatorDetails(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) MAP(org.jboss.ws.api.addressing.MAP) CoordinatorCompletionCoordinatorDetails(com.arjuna.wst.tests.arq.TestCoordinatorCompletionCoordinatorProcessor.CoordinatorCompletionCoordinatorDetails) Test(org.junit.Test)

Aggregations

SoapFaultType (com.arjuna.webservices.SoapFaultType)10 QName (javax.xml.namespace.QName)10 InstanceIdentifier (com.arjuna.webservices11.wsarj.InstanceIdentifier)9 SoapFault11 (com.arjuna.webservices11.SoapFault11)7 MAP (org.jboss.ws.api.addressing.MAP)7 Test (org.junit.Test)7 SoapFault (com.arjuna.webservices.SoapFault)2 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)2 InvalidEnumerationException (com.arjuna.webservices.util.InvalidEnumerationException)1 ArjunaContext (com.arjuna.webservices11.wsarj.ArjunaContext)1 State (com.arjuna.webservices11.wsat.State)1 CompletionInitiatorProcessor (com.arjuna.webservices11.wsat.processors.CompletionInitiatorProcessor)1 CoordinatorCompletionCoordinatorDetails (com.arjuna.wst.tests.arq.TestCoordinatorCompletionCoordinatorProcessor.CoordinatorCompletionCoordinatorDetails)1 CoordinatorCompletionParticipantDetails (com.arjuna.wst.tests.arq.TestCoordinatorCompletionParticipantProcessor.CoordinatorCompletionParticipantDetails)1 CoordinatorDetails (com.arjuna.wst.tests.arq.TestCoordinatorProcessor.CoordinatorDetails)1 ParticipantCompletionCoordinatorDetails (com.arjuna.wst.tests.arq.TestParticipantCompletionCoordinatorProcessor.ParticipantCompletionCoordinatorDetails)1 ParticipantCompletionParticipantDetails (com.arjuna.wst.tests.arq.TestParticipantCompletionParticipantProcessor.ParticipantCompletionParticipantDetails)1 ParticipantDetails (com.arjuna.wst.tests.arq.TestParticipantProcessor.ParticipantDetails)1 Detail (javax.xml.soap.Detail)1 SOAPFault (javax.xml.soap.SOAPFault)1