Search in sources :

Example 36 with PipeLineSessionBase

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

the class XmlValidatorTest method addNamespaceToSchema.

@Test
public void addNamespaceToSchema() throws ConfigurationException, IOException, PipeRunException, XmlValidatorException {
    XmlValidator validator = getValidator("http://www.ing.com/testxmlns " + "/Basic/xsd/A_without_targetnamespace.xsd", true);
    validator.validate(getTestXml("/Basic/in/ok.xml"), new PipeLineSessionBase());
}
Also used : AbstractXmlValidator(nl.nn.adapterframework.validation.AbstractXmlValidator) XercesXmlValidator(nl.nn.adapterframework.validation.XercesXmlValidator) JavaxXmlValidator(nl.nn.adapterframework.validation.JavaxXmlValidator) PipeLineSessionBase(nl.nn.adapterframework.core.PipeLineSessionBase) Test(org.junit.Test)

Example 37 with PipeLineSessionBase

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

the class XmlValidatorTest method validationUnknownNamespaceSwitchedOn.

@Test
public void validationUnknownNamespaceSwitchedOn() throws PipeRunException, ConfigurationException, IOException, XmlValidatorException {
    XmlValidator validator = getValidator("http://schemas.xmlsoap.org/soap/envelope/ " + // every other namespace is thus unknown
    "/Tibco/xsd/soap/envelope.xsd ");
    validator.setIgnoreUnknownNamespaces(true);
    validator.validate(getTestXml("/Tibco/in/step5error_unknown_namespace.xml"), new PipeLineSessionBase());
}
Also used : AbstractXmlValidator(nl.nn.adapterframework.validation.AbstractXmlValidator) XercesXmlValidator(nl.nn.adapterframework.validation.XercesXmlValidator) JavaxXmlValidator(nl.nn.adapterframework.validation.JavaxXmlValidator) PipeLineSessionBase(nl.nn.adapterframework.core.PipeLineSessionBase) Test(org.junit.Test)

Example 38 with PipeLineSessionBase

use of nl.nn.adapterframework.core.PipeLineSessionBase 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)

Aggregations

PipeLineSessionBase (nl.nn.adapterframework.core.PipeLineSessionBase)38 Test (org.junit.Test)14 IPipeLineSession (nl.nn.adapterframework.core.IPipeLineSession)12 IOException (java.io.IOException)8 AbstractXmlValidator (nl.nn.adapterframework.validation.AbstractXmlValidator)8 JavaxXmlValidator (nl.nn.adapterframework.validation.JavaxXmlValidator)8 XercesXmlValidator (nl.nn.adapterframework.validation.XercesXmlValidator)8 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)6 Iterator (java.util.Iterator)5 Map (java.util.Map)5 PipeRunResult (nl.nn.adapterframework.core.PipeRunResult)5 HashMap (java.util.HashMap)4 ListenerException (nl.nn.adapterframework.core.ListenerException)4 PipeForward (nl.nn.adapterframework.core.PipeForward)4 ParameterResolutionContext (nl.nn.adapterframework.parameters.ParameterResolutionContext)4 ArrayList (java.util.ArrayList)3 Date (java.util.Date)3 PipeRunException (nl.nn.adapterframework.core.PipeRunException)3 SenderException (nl.nn.adapterframework.core.SenderException)3 ParseException (java.text.ParseException)2