use of nl.nn.adapterframework.core.PipeLineSessionBase in project iaf by ibissource.
the class TestPipeLine method processMessage.
private PipeLineResult processMessage(IAdapter adapter, String message, boolean writeSecLogMessage) {
String messageId = "testmessage" + Misc.createSimpleUUID();
IPipeLineSession pls = new PipeLineSessionBase();
Map ibisContexts = XmlUtils.getIbisContext(message);
String technicalCorrelationId = null;
if (ibisContexts != null) {
String contextDump = "ibisContext:";
for (Iterator it = ibisContexts.keySet().iterator(); it.hasNext(); ) {
String key = (String) it.next();
String value = (String) ibisContexts.get(key);
if (log.isDebugEnabled()) {
contextDump = contextDump + "\n " + key + "=[" + value + "]";
}
if (key.equals(IPipeLineSession.technicalCorrelationIdKey)) {
technicalCorrelationId = value;
} else {
pls.put(key, value);
}
}
if (log.isDebugEnabled()) {
log.debug(contextDump);
}
}
Date now = new Date();
PipeLineSessionBase.setListenerParameters(pls, messageId, technicalCorrelationId, now, now);
if (writeSecLogMessage) {
secLog.info("message [" + message + "]");
}
// Temporarily change threadName so logging for pipeline to test will
// not be suppressed (see property 'log.thread.rejectRegex')
String ctName = Thread.currentThread().getName();
String ntName = StringUtils.replace(ctName, "WebControlTestPipeLine", "WCTestPipeLine");
try {
Thread.currentThread().setName(ntName);
return adapter.processMessage(messageId, message, pls);
} finally {
Thread.currentThread().setName(ctName);
}
}
use of nl.nn.adapterframework.core.PipeLineSessionBase in project iaf by ibissource.
the class XmlValidatorTest method validationUnknownNamespaceSwitchedOff.
@Test(expected = XmlValidatorException.class)
public void validationUnknownNamespaceSwitchedOff() 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(false);
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 XmlValidatorTest method addNamespaceToSchemaWithErrors.
@Test(expected = XmlValidatorException.class)
public void addNamespaceToSchemaWithErrors() 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/with_errors.xml"), new PipeLineSessionBase());
}
use of nl.nn.adapterframework.core.PipeLineSessionBase in project iaf by ibissource.
the class XmlValidatorTest method addNamespaceToSchemaNamesspaceMismatch.
@Test(expected = XmlValidatorException.class)
public void addNamespaceToSchemaNamesspaceMismatch() throws ConfigurationException, IOException, PipeRunException, XmlValidatorException {
XmlValidator validator = getValidator("http://www.ing.com/testxmlns_mismatch " + "/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 step5ValidationUnknownNamespaces.
@Test(expected = XmlValidatorException.class)
@Ignore("This fails in JavaXmlValidator, and this is actually defendable, because the soap envelope accepts any children, so also the namespace doesn't really matter.")
public void step5ValidationUnknownNamespaces() throws PipeRunException, ConfigurationException, IOException, XmlValidatorException {
XmlValidator validator = getValidator("http://schemas.xmlsoap.org/soap/envelope/ " + "/Tibco/xsd/soap/envelope.xsd ");
validator.validate(getTestXml("/Tibco/in/step5.xml"), new PipeLineSessionBase());
}
Aggregations