Search in sources :

Example 46 with PipeForward

use of nl.nn.adapterframework.core.PipeForward in project iaf by ibissource.

the class WsdlXmlValidatorTest method wsdlTibcoFailMessage.

@Test(expected = XmlValidatorException.class)
public void wsdlTibcoFailMessage() throws IOException, PipeRunException, SAXException, WSDLException, ConfigurationException, XmlValidatorException {
    WsdlXmlValidator val = new WsdlXmlValidator();
    val.setWsdl(TIBCO);
    val.setThrowException(true);
    val.registerForward(new PipeForward("success", null));
    val.configure();
    val.validate("<Envelope xmlns=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" + "  <Body>\n" + "    <MessageHeader xmlns=\"http://www.ing.com/CSP/XSD/General/Message_2\">\n" + "      <From>\n" + "        <Id>Ibis4Toegang</Id>\n" + "      </From>\n" + "      <HeaderFields>\n" + "        <ConversationId/>\n" + "        <MessageId>WPNLD8921975_0a4ac029-7747a1ed_12da7d4b033_-7ff3</MessageId>\n" + "        <ExternalRefToMessageId/>\n" + "        <Timestamp>2001-12-17T09:30:47</Timestamp>\n" + "      </HeaderFields>\n" + "    </MessageHeader>\n" + "    <Request xmlns=\"http://www.ing.com/nl/banking/coe/xsd/bankingcustomer_generate_01/getpartybasicdatabanking_01\">\n" + "      <BankSparen xmlns=\"http://www.ing.com/bis/xsd/nl/banking/bankingcustomer_generate_01_getpartybasicdatabanking_request_01\">\n" + "        <PRD>\n" + "          <KLTERROR>\n" + "            <KLT_NA_RELNUM>181373377001</KLT_NA_RELNUM>\n" + "          </KLTERROR>\n" + "        </PRD>\n" + "      </BankSparen>\n" + "    </Request>\n" + "  </Body>\n" + "</Envelope>\n" + "", session);
}
Also used : PipeForward(nl.nn.adapterframework.core.PipeForward) Test(org.junit.Test)

Example 47 with PipeForward

use of nl.nn.adapterframework.core.PipeForward in project iaf by ibissource.

the class XmlValidatorTest method getSuccess.

static PipeForward getSuccess() {
    PipeForward forward = new PipeForward();
    forward.setName("success");
    return forward;
}
Also used : PipeForward(nl.nn.adapterframework.core.PipeForward)

Example 48 with PipeForward

use of nl.nn.adapterframework.core.PipeForward in project iaf by ibissource.

the class XmlValidatorTest2 method validate.

@Override
public String validate(String rootNamespace, String schemaLocation, boolean addNamespaceToSchema, boolean ignoreUnknownNamespaces, String inputfile, String[] expectedFailureReasons) throws ConfigurationException, InstantiationException, IllegalAccessException, XmlValidatorException, PipeRunException, IOException {
    String testXml = inputfile != null ? getTestXml(inputfile + ".xml") : null;
    IPipeLineSession session = new PipeLineSessionBase();
    try {
        XmlValidator validator = getValidator(schemaLocation, addNamespaceToSchema, implementation);
        validator.setIgnoreUnknownNamespaces(ignoreUnknownNamespaces);
        PipeForward forward = validator.validate(testXml, session);
        evaluateResult(forward.getName(), session, null, expectedFailureReasons);
    } catch (Exception e) {
        evaluateResult(null, session, e, expectedFailureReasons);
        return "Invalid XML";
    }
    return null;
}
Also used : AbstractXmlValidator(nl.nn.adapterframework.validation.AbstractXmlValidator) XercesXmlValidator(nl.nn.adapterframework.validation.XercesXmlValidator) JavaxXmlValidator(nl.nn.adapterframework.validation.JavaxXmlValidator) IPipeLineSession(nl.nn.adapterframework.core.IPipeLineSession) PipeForward(nl.nn.adapterframework.core.PipeForward) PipeRunException(nl.nn.adapterframework.core.PipeRunException) IOException(java.io.IOException) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) XmlValidatorException(nl.nn.adapterframework.validation.XmlValidatorException) PipeLineSessionBase(nl.nn.adapterframework.core.PipeLineSessionBase)

Example 49 with PipeForward

use of nl.nn.adapterframework.core.PipeForward in project iaf by ibissource.

the class Json2WsdlXmlValidatorTest method wsdlValidate.

public void wsdlValidate(String wsdl, String soapBody, String testSoap, String testXml, String testJsonStraight, String testJsonCompact, String targetContent1, String targetContent2) throws IOException, PipeRunException, SAXException, WSDLException, ConfigurationException, XmlValidatorException {
    WsdlXmlValidator val = new WsdlXmlValidator();
    val.setWsdl(wsdl);
    // val.setSoapBody("TradePriceRequest");
    val.setThrowException(true);
    val.registerForward(new PipeForward("success", null));
    val.setSoapBody(soapBody);
    val.configure();
    boolean compactJsonArrays = false;
    validate("Validate XML", val, getTestXml(testSoap), null, compactJsonArrays, targetContent1, targetContent2);
    validate("XML to JSON", val, getTestXml(testSoap), "json", compactJsonArrays, targetContent1, targetContent2);
    validate("JSON to XML", val, getTestXml(testJsonStraight), "xml", compactJsonArrays, targetContent1, targetContent2);
    validate("JSON to JSON", val, getTestXml(testJsonStraight), "json", compactJsonArrays, targetContent1, targetContent2);
    compactJsonArrays = true;
    validate("Validate XML", val, getTestXml(testSoap), null, compactJsonArrays, targetContent1, targetContent2);
    validate("XML to JSON", val, getTestXml(testSoap), "json", compactJsonArrays, targetContent1, targetContent2);
    // basic json Parsing compactJsonArrays=true
    validate("JSON to XML", val, getTestXml(testJsonCompact), "xml", compactJsonArrays, targetContent1, targetContent2);
    validate("JSON to JSON", val, getTestXml(testJsonCompact), "json", compactJsonArrays, targetContent1, targetContent2);
    validate("JSON to XML, extra spaces", val, "  " + getTestXml(testJsonCompact), "xml", compactJsonArrays, targetContent1, targetContent2);
    // check compatibiliy of compactJsonArrays=true with straight json
    validate("straight JSON to XML", val, getTestXml(testJsonStraight), "xml", compactJsonArrays, targetContent1, targetContent2);
    validate("straight JSON to JSON", val, getTestXml(testJsonStraight), "json", compactJsonArrays, targetContent1, targetContent2);
}
Also used : PipeForward(nl.nn.adapterframework.core.PipeForward)

Aggregations

PipeForward (nl.nn.adapterframework.core.PipeForward)49 PipeRunResult (nl.nn.adapterframework.core.PipeRunResult)23 PipeRunException (nl.nn.adapterframework.core.PipeRunException)21 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)10 Test (org.junit.Test)8 IOException (java.io.IOException)7 ParameterResolutionContext (nl.nn.adapterframework.parameters.ParameterResolutionContext)7 ParameterException (nl.nn.adapterframework.core.ParameterException)6 ParameterList (nl.nn.adapterframework.parameters.ParameterList)6 IPipe (nl.nn.adapterframework.core.IPipe)4 Map (java.util.Map)3 TransformerConfigurationException (javax.xml.transform.TransformerConfigurationException)3 ConfigurationWarnings (nl.nn.adapterframework.configuration.ConfigurationWarnings)3 IPipeLineSession (nl.nn.adapterframework.core.IPipeLineSession)3 ITransactionalStorage (nl.nn.adapterframework.core.ITransactionalStorage)3 PipeLineSessionBase (nl.nn.adapterframework.core.PipeLineSessionBase)3 ApiWsdlXmlValidator (nl.nn.adapterframework.extensions.api.ApiWsdlXmlValidator)3 ParameterValueList (nl.nn.adapterframework.parameters.ParameterValueList)3 StatisticsKeeper (nl.nn.adapterframework.statistics.StatisticsKeeper)3 InputStream (java.io.InputStream)2