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());
}
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());
}
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;
}
Aggregations