/** * Invalid service referred * * @throws Exception */ @Test(groups = "wso2.esb", description = "- Custom proxy -Fault sequence existing fault sequence") public void testCustomProxyFaultExistingFaultSequence() throws Exception { try { axis2Client.sendSimpleStockQuoteRequest( getProxyServiceURLHttp("StockQuoteProxyFour"), null, "WSO2"); fail(); } catch (AxisFault axisFault) { assertTrue( axisFault.getReason().contains("Fault sequence invoked"), "Fault: value 'reason' mismatched"); } }
public void testSample() throws Exception { getStringResultOfTest(StockQuoteClient.executeTestClient()); getStringResultOfTest(StockQuoteClient.executeTestClient()); getStringResultOfTest(StockQuoteClient.executeTestClient()); String resultString = getStringResultOfTest(StockQuoteClient.executeTestClient()); assertXpathExists("ns:getQuoteResponse", resultString); assertXpathExists("ns:getQuoteResponse/ns:return", resultString); try { getStringResultOfTest(StockQuoteClient.executeTestClient()); } catch (AxisFault f) { assertEquals("**Access Denied**", f.getReason()); } }
/** * This is a negative test under iterator mediator.It will specify an invalid xpath as the * 'attachPath' and verify error handling. */ @Test( groups = {"wso2.esb"}, description = "Tests an invalid 'attachPath' expression in Iterator Mediator") public void testInvalidXPath() throws Exception { OMElement response; try { response = axis2Client.sendMultipleQuoteRequest(getMainSequenceURL(), null, symbol, 5); Assert.fail( "This Request must throw AxisFault"); // This will execute when the exception is not // thrown as expected } catch (AxisFault message) { assertEquals( message.getReason(), ESBTestConstant.INCOMING_MESSAGE_IS_NULL, "Iterator mediator worked even with a invalid XPath expression for 'attachPath'"); } }
@Test( groups = {"wso2.esb"}, description = "Creating SOAP1.2 fault code VersionMismatched") public void testSOAP12FaultCodeVersionMismatched() 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(), "Soap12FaultCodeVersionMismatchedTestCase", "Fault Reason Mismatched"); assertEquals( expected.getFaultCode().getLocalPart(), "VersionMismatch", "Fault code value mismatched"); assertEquals( expected.getFaultCode().getPrefix(), "soap12Env", "Fault code prefix mismatched"); } }
@Test( groups = {"wso2.esb"}, description = "Creating SOAP1.2 fault node") public void testSOAP12FaultNode() throws AxisFault { OMElement response; try { response = axis2Client.sendSimpleStockQuoteRequest( getMainSequenceURL(), "http://localhost:9010/services/NonExistingService", "WSO2"); fail("This query must throw an exception."); } catch (AxisFault expected) { log.info("Test passed with Fault Message : " + expected.getMessage()); assertTrue(expected.getReason().contains("Connection refused"), "ERROR Message mismatched"); assertEquals( expected.getFaultCode().getLocalPart(), "VersionMismatch", "Fault code value mismatched"); assertEquals( expected.getFaultCode().getPrefix(), "soap12Env", "Fault code prefix mismatched"); assertEquals( expected.getFaultNodeElement().getNodeValue(), "automation-node", "Fault node mismatched"); } }