Java Code Examples for org.apache.axis2.AxisFault#getFaultDetailElement()
The following examples show how to use
org.apache.axis2.AxisFault#getFaultDetailElement() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Soap11FaultDetailAsElementTestCase.java From micro-integrator with Apache License 2.0 | 6 votes |
@Test(groups = { "wso2.esb" }, description = "Creating SOAP1.1 fault details as Element") public void testSOAP11FaultDetailAsElement() { try { axis2Client.sendSimpleStockQuoteRequest(getProxyServiceURLHttp("Soap11FaultDetailAsElementProxy"), null, "WSO2"); fail("This query must throw an exception."); } catch (AxisFault expected) { log.info("Fault Message : " + expected.getMessage()); assertEquals(expected.getReason(), "Soap11FaultDetailAsElementTestCase", "Fault Reason Mismatched"); assertEquals(expected.getFaultCode().getPrefix(), "soap11Env", "Fault code prefix mismatched"); SOAPFaultDetail detailElm = expected.getFaultDetailElement(); OMElement statusOME = detailElm .getFirstChildWithName(new QName("http://ws.apache.org/ns/synapse", "StatusCode", "axis2ns1")); assertNotNull(statusOME, "Fault detail element StatusCode null"); assertEquals(statusOME.getText(), "1000", "Fault detail StatusCode mismatched"); OMElement messageOME = detailElm .getFirstChildWithName(new QName("http://ws.apache.org/ns/synapse", "message", "axis2ns1")); assertNotNull(messageOME, "Fault detail element message null"); assertEquals(messageOME.getText(), "fault details by automation", "Fault detail message mismatched"); } }
Example 2
Source File: Soap12FaultDetailAsElementTestCase.java From micro-integrator with Apache License 2.0 | 6 votes |
@Test(groups = { "wso2.esb" }, description = "Creating SOAP1.2 fault details as Element") public void testSOAP12FaultDetailAsElement() throws AxisFault { String proxyServiceName = "Soap12FaultDetailAsElementTestCaseProxy"; try { axis2Client.sendSimpleStockQuoteSoap12(getProxyServiceURLHttp(proxyServiceName), "http://localhost:9010/services/NonExistingService", "WSO2"); fail("This query must throw an exception."); } catch (AxisFault expected) { log.info("Fault Message : " + expected.getMessage()); assertEquals(expected.getReason(), "Soap12FaultDetailAsElementTestCase", "Fault Reason Mismatched"); assertEquals(expected.getFaultCode().getLocalPart(), "VersionMismatch", "Fault code value mismatched"); assertEquals(expected.getFaultCode().getPrefix(), "soap12Env", "Fault code prefix mismatched"); SOAPFaultDetail detailElm = expected.getFaultDetailElement(); OMElement statusOME = detailElm .getFirstChildWithName(new QName("http://ws.apache.org/ns/synapse", "StatusCode", "axis2ns1")); assertNotNull(statusOME, "Fault detail element StatusCode null"); assertEquals(statusOME.getText(), "1000", "Fault detail StatusCode mismatched"); OMElement messageOME = detailElm .getFirstChildWithName(new QName("http://ws.apache.org/ns/synapse", "message", "axis2ns1")); assertNotNull(messageOME, "Fault detail element message null"); assertEquals(messageOME.getText(), "fault details by automation", "Fault detail message mismatched"); } }
Example 3
Source File: ScriptIntegrationToGenerateFaultTestCase.java From micro-integrator with Apache License 2.0 | 6 votes |
@Test(groups = "wso2.esb", description = "Using script mediator to generate faults. Test 1.") public void testGenerateFaults1() throws XMLStreamException { try { axis2Client .sendSimpleStockQuoteRequest(getProxyServiceURLHttp("scriptMediatorInFaultSequenceTestProxy"), null, "MSFT"); Assert.fail("Request must throw a AxisFault"); } catch (AxisFault e) { SOAPFaultDetail faultDetail = e.getFaultDetailElement(); assertNotNull(faultDetail, "Fault response message null"); OMElement firstElemnt = faultDetail.getFirstElement(); OMElement errorCode = firstElemnt.getFirstChildWithName(new QName("ErrorCode")); OMElement errorText = firstElemnt.getFirstChildWithName(new QName("ErrorText")); assertEquals(faultDetail.getFirstElement().getLocalName(), "AppErrorCode", "Fault detail element"); assertEquals(errorCode.getText(), "8719", "Fault detail element"); assertEquals(errorText.getText(), "Issue has", "Fault detail element"); } }
Example 4
Source File: ScriptIntegrationToGenerateFaultTestCase.java From micro-integrator with Apache License 2.0 | 6 votes |
@Test(groups = "wso2.esb", description = "Using script mediator to generate faults.Test 2. ") public void testGenerateFaults2() throws XMLStreamException { try { axis2Client .sendSimpleStockQuoteRequest(getProxyServiceURLHttp("scriptMediatorInFaultSequenceTestProxy"), null, "SUN"); Assert.fail("Request must throw a AxisFault"); } catch (AxisFault e) { SOAPFaultDetail faultDetail = e.getFaultDetailElement(); assertNotNull(faultDetail, "Fault response message null"); OMElement firstElemnt = faultDetail.getFirstElement(); OMElement errorCode = firstElemnt.getFirstChildWithName(new QName("ErrorCode")); OMElement errorText = firstElemnt.getFirstChildWithName(new QName("ErrorText")); assertEquals(faultDetail.getFirstElement().getLocalName(), "AppErrorCode", "Fault detail element"); assertEquals(errorCode.getText(), "8719", "Fault detail element"); assertEquals(errorText.getText(), "Issue has", "Fault detail element"); } }
Example 5
Source File: Soap11FaultDetailAsElementTestCase.java From product-ei with Apache License 2.0 | 6 votes |
@Test(groups = {"wso2.esb"}, description = "Creating SOAP1.1 fault details as Element") public void testSOAP11FaultDetailAsElement() throws AxisFault { try { axis2Client.sendSimpleStockQuoteRequest( getMainSequenceURL(), null, "WSO2"); fail("This query must throw an exception."); } catch (AxisFault expected) { log.info("Fault Message : " + expected.getMessage()); assertEquals(expected.getReason(), "Soap11FaultDetailAsElementTestCase", "Fault Reason Mismatched"); assertEquals(expected.getFaultCode().getPrefix(), "soap11Env", "Fault code prefix mismatched"); SOAPFaultDetail detailElm = expected.getFaultDetailElement(); OMElement statusOME = detailElm.getFirstChildWithName(new QName("http://ws.apache.org/ns/synapse", "StatusCode", "axis2ns1")); assertNotNull(statusOME, "Fault detail element StatusCode null"); assertEquals(statusOME.getText(), "1000", "Fault detail StatusCode mismatched"); OMElement messageOME = detailElm.getFirstChildWithName(new QName("http://ws.apache.org/ns/synapse", "message", "axis2ns1")); assertNotNull(messageOME, "Fault detail element message null"); assertEquals(messageOME.getText(), "fault details by automation", "Fault detail message mismatched"); } }
Example 6
Source File: Soap12FaultDetailAsElementTestCase.java From product-ei with Apache License 2.0 | 6 votes |
@Test(groups = {"wso2.esb"}, description = "Creating SOAP1.2 fault details as Element") public void testSOAP12FaultDetailAsElement() throws AxisFault { try { axis2Client.sendSimpleStockQuoteSoap12( getMainSequenceURL(), "http://localhost:9010/services/NonExistingService", "WSO2"); fail("This query must throw an exception."); } catch (AxisFault expected) { log.info("Fault Message : " + expected.getMessage()); assertEquals(expected.getReason(), "Soap12FaultDetailAsElementTestCase", "Fault Reason Mismatched"); assertEquals(expected.getFaultCode().getLocalPart(), "VersionMismatch", "Fault code value mismatched"); assertEquals(expected.getFaultCode().getPrefix(), "soap12Env", "Fault code prefix mismatched"); SOAPFaultDetail detailElm = expected.getFaultDetailElement(); OMElement statusOME = detailElm.getFirstChildWithName(new QName("http://ws.apache.org/ns/synapse", "StatusCode", "axis2ns1")); assertNotNull(statusOME, "Fault detail element StatusCode null"); assertEquals(statusOME.getText(), "1000", "Fault detail StatusCode mismatched"); OMElement messageOME = detailElm.getFirstChildWithName(new QName("http://ws.apache.org/ns/synapse", "message", "axis2ns1")); assertNotNull(messageOME, "Fault detail element message null"); assertEquals(messageOME.getText(), "fault details by automation", "Fault detail message mismatched"); } }
Example 7
Source File: ScriptIntegrationToGenerateFaultTestCase.java From product-ei with Apache License 2.0 | 5 votes |
@Test(groups = "wso2.esb", description = "Using script mediator to generate faults. Test 1.") public void testGenerateFaults1() throws XMLStreamException { try { axis2Client.sendSimpleStockQuoteRequest( getProxyServiceURLHttp("scriptMediatorInFaultSequenceTestProxy"), null, "MSFT"); Assert.fail("Request must throw a AxisFault"); } catch (AxisFault e) { SOAPFaultDetail faultDetail = e.getFaultDetailElement(); assertNotNull(faultDetail, "Fault response message null"); OMElement firstElemnt = faultDetail.getFirstElement(); OMElement errorCode = firstElemnt.getFirstChildWithName(new QName("ErrorCode")); OMElement errorText = firstElemnt.getFirstChildWithName(new QName("ErrorText")); assertEquals(faultDetail.getFirstElement().getLocalName(), "AppErrorCode", "Fault detail element"); assertEquals(errorCode.getText(), "8719", "Fault detail element"); assertEquals(errorText.getText(), "Issue has", "Fault detail element"); } }
Example 8
Source File: ScriptIntegrationToGenerateFaultTestCase.java From product-ei with Apache License 2.0 | 5 votes |
@Test(groups = "wso2.esb", description = "Using script mediator to generate faults.Test 2. " ) public void testGenerateFaults2() throws XMLStreamException { try { axis2Client.sendSimpleStockQuoteRequest( getProxyServiceURLHttp("scriptMediatorInFaultSequenceTestProxy"), null, "SUN"); Assert.fail("Request must throw a AxisFault"); } catch (AxisFault e) { SOAPFaultDetail faultDetail = e.getFaultDetailElement(); assertNotNull(faultDetail, "Fault response message null"); OMElement firstElemnt = faultDetail.getFirstElement(); OMElement errorCode = firstElemnt.getFirstChildWithName(new QName("ErrorCode")); OMElement errorText = firstElemnt.getFirstChildWithName(new QName("ErrorText")); assertEquals(faultDetail.getFirstElement().getLocalName(), "AppErrorCode", "Fault detail element"); assertEquals(errorCode.getText(), "8719", "Fault detail element"); assertEquals(errorText.getText(), "Issue has", "Fault detail element"); } }