Search in sources :

Example 31 with PipeLineSessionBase

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

the class SoapValidatorTest method validate12_invalid.

@Test(expected = PipeRunException.class)
public void validate12_invalid() throws ConfigurationException, IOException, PipeRunException {
    SoapValidator xml = getSoapValidator();
    xml.setSoapVersion("1.2");
    xml.doPipe(getTestXml("/SoapValidator/invalid_soap.xml"), new PipeLineSessionBase());
}
Also used : PipeLineSessionBase(nl.nn.adapterframework.core.PipeLineSessionBase) Test(org.junit.Test)

Example 32 with PipeLineSessionBase

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

the class Json2XmlValidatorSmileyTest method xmlToJsonViaPipe.

public String xmlToJsonViaPipe(String xml) throws ConfigurationException, PipeStartException, PipeRunException {
    Json2XmlValidator json2xml = new Json2XmlValidator();
    json2xml.setWarn(false);
    json2xml.setSchema(xsd);
    json2xml.setRoot("x");
    json2xml.setOutputFormat(json2xml.FORMAT_JSON);
    json2xml.setThrowException(true);
    json2xml.registerForward(new PipeForward("success", null));
    json2xml.configure();
    json2xml.start();
    IPipeLineSession pipeLineSession = new PipeLineSessionBase();
    PipeRunResult prr = json2xml.doPipe(xml, pipeLineSession);
    return (String) prr.getResult();
}
Also used : PipeRunResult(nl.nn.adapterframework.core.PipeRunResult) Json2XmlValidator(nl.nn.adapterframework.pipes.Json2XmlValidator) PipeForward(nl.nn.adapterframework.core.PipeForward) IPipeLineSession(nl.nn.adapterframework.core.IPipeLineSession) PipeLineSessionBase(nl.nn.adapterframework.core.PipeLineSessionBase)

Example 33 with PipeLineSessionBase

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

the class Json2XmlValidatorSmileyTest method jsonToXmlViaPipe.

public String jsonToXmlViaPipe(String json) throws ConfigurationException, PipeStartException, PipeRunException {
    Json2XmlValidator json2xml = new Json2XmlValidator();
    json2xml.setWarn(false);
    json2xml.setSchema(xsd);
    json2xml.setRoot("x");
    json2xml.setThrowException(true);
    json2xml.registerForward(new PipeForward("success", null));
    json2xml.configure();
    json2xml.start();
    IPipeLineSession pipeLineSession = new PipeLineSessionBase();
    PipeRunResult prr = json2xml.doPipe(json, pipeLineSession);
    return (String) prr.getResult();
}
Also used : PipeRunResult(nl.nn.adapterframework.core.PipeRunResult) Json2XmlValidator(nl.nn.adapterframework.pipes.Json2XmlValidator) PipeForward(nl.nn.adapterframework.core.PipeForward) IPipeLineSession(nl.nn.adapterframework.core.IPipeLineSession) PipeLineSessionBase(nl.nn.adapterframework.core.PipeLineSessionBase)

Example 34 with PipeLineSessionBase

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

the class TestPipeline method processMessage.

@SuppressWarnings({ "rawtypes", "unchecked" })
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 + "]");
    }
    return adapter.processMessage(messageId, message, pls);
}
Also used : Iterator(java.util.Iterator) IPipeLineSession(nl.nn.adapterframework.core.IPipeLineSession) HashMap(java.util.HashMap) Map(java.util.Map) MultivaluedMap(javax.ws.rs.core.MultivaluedMap) Date(java.util.Date) PipeLineSessionBase(nl.nn.adapterframework.core.PipeLineSessionBase)

Example 35 with PipeLineSessionBase

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

the class XmlValidatorTest method step5ValidationErrorUnknownNamespace.

// TODO: make more precise, prefer a ConfigurationException over a XmlValidatorException
// step4errorr1.xml uses the namespace xmlns="http://www.ing.com/BESTAATNIET
@Test(expected = Exception.class)
public void step5ValidationErrorUnknownNamespace() throws PipeRunException, ConfigurationException, IOException, XmlValidatorException {
    XmlValidator validator = getValidator("http://schemas.xmlsoap.org/soap/envelope/ " + "/Tibco/xsd/soap/envelope.xsd " + "http://www.ing.com/CSP/XSD/General/Message_2 " + "/Tibco/wsdl/BankingCustomer_01_GetPartyBasicDataBanking_01_concrete1/Message_2.xsd " + "http://www.ing.com/nl/banking/coe/xsd/bankingcustomer_generate_01/getpartybasicdatabanking_01 " + "/Tibco/wsdl/BankingCustomer_01_GetPartyBasicDataBanking_01_concrete1/getpartybasicdatabanking_01.xsd " + "http://www.ing.com/bis/xsd/nl/banking/bankingcustomer_generate_01_getpartybasicdatabanking_request_01 " + "/Tibco/wsdl/BankingCustomer_01_GetPartyBasicDataBanking_01_concrete1/bankingcustomer_generate_01_getpartybasicdatabanking_request_01.xsd");
    validator.setIgnoreUnknownNamespaces(false);
    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)

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