Search in sources :

Example 86 with PipeLineSession

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

the class XmlSwitchTest method withSessionKey.

@Test
public void withSessionKey() throws Exception {
    pipe.registerForward(new PipeForward("Envelope", "Envelope-Path"));
    pipe.registerForward(new PipeForward("selectValue", "SelectValue-Path"));
    pipe.setSessionKey("selectKey");
    session = new PipeLineSession();
    session.put("selectKey", "selectValue");
    Message input = TestFileUtils.getTestFileMessage("/XmlSwitch/in.xml");
    testSwitch(input, "selectValue");
}
Also used : Message(nl.nn.adapterframework.stream.Message) PipeLineSession(nl.nn.adapterframework.core.PipeLineSession) PipeForward(nl.nn.adapterframework.core.PipeForward) Test(org.junit.Test)

Example 87 with PipeLineSession

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

the class XmlSwitchTest method basicXpathSessionKeyUsedAsInput.

@Test
public void basicXpathSessionKeyUsedAsInput() throws Exception {
    pipe.registerForward(new PipeForward("Envelope", "Envelope-Path"));
    pipe.setSessionKey("sessionKey");
    pipe.setXpathExpression("name(/node()[position()=last()])");
    session = new PipeLineSession();
    Message input = TestFileUtils.getTestFileMessage("/XmlSwitch/in.xml");
    session.put("sessionKey", input);
    testSwitch(new Message("dummy"), "Envelope");
}
Also used : Message(nl.nn.adapterframework.stream.Message) PipeLineSession(nl.nn.adapterframework.core.PipeLineSession) PipeForward(nl.nn.adapterframework.core.PipeForward) Test(org.junit.Test)

Example 88 with PipeLineSession

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

the class XmlSwitchTest method withSessionKeyOverridesGetInputFromSessionKey.

@Test
public void withSessionKeyOverridesGetInputFromSessionKey() throws Exception {
    pipe.registerForward(new PipeForward("Envelope", "Envelope-Path"));
    pipe.registerForward(new PipeForward("dummy", "dummy-Path"));
    pipe.setGetInputFromSessionKey("input");
    pipe.setSessionKey("selectKey");
    pipe.setXpathExpression("name(/node()[position()=last()])");
    session = new PipeLineSession();
    session.put("selectKey", "<dummy/>");
    Message input = TestFileUtils.getTestFileMessage("/XmlSwitch/in.xml");
    session.put("input", input);
    testSwitch(input, "dummy");
}
Also used : Message(nl.nn.adapterframework.stream.Message) PipeLineSession(nl.nn.adapterframework.core.PipeLineSession) PipeForward(nl.nn.adapterframework.core.PipeForward) Test(org.junit.Test)

Example 89 with PipeLineSession

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

the class SoapWrapperPipeTest method testWrapSoapVersionSoap12.

@Test
public void testWrapSoapVersionSoap12() throws Exception {
    pipe.setOutputNamespace(TARGET_NAMESPACE);
    pipe.setSoapVersion(SoapVersion.SOAP12);
    pipe.configure();
    pipe.start();
    String input = "<root>\n" + "<attrib>1</attrib>\n" + "<attrib>2</attrib>\n" + "</root>";
    String expected = "<soapenv:Envelope xmlns:soapenv=\"http://www.w3.org/2003/05/soap-envelope\"><soapenv:Body>" + "<root xmlns=\"" + TARGET_NAMESPACE + "\">\n" + "<attrib>1</attrib>\n" + "<attrib>2</attrib>\n" + "</root></soapenv:Body></soapenv:Envelope>";
    PipeRunResult prr = doPipe(pipe, input, new PipeLineSession());
    String actual = prr.getResult().asString();
    TestAssertions.assertEqualsIgnoreCRLF(expected, actual);
}
Also used : PipeRunResult(nl.nn.adapterframework.core.PipeRunResult) PipeLineSession(nl.nn.adapterframework.core.PipeLineSession) Test(org.junit.Test)

Example 90 with PipeLineSession

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

the class SoapWrapperPipeTest method testUnwrapSwitchRoot.

@Test
public void testUnwrapSwitchRoot() throws Exception {
    pipe.setDirection(Direction.UNWRAP);
    pipe.setRoot("OtherRoot");
    pipe.configure();
    pipe.start();
    String input = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><soapenv:Body>" + "<root xmlns=\"" + TARGET_NAMESPACE + "\">\n" + "<attrib>1</attrib>\n" + "<attrib>2</attrib>\n" + "</root></soapenv:Body></soapenv:Envelope>";
    String expected = "<OtherRoot xmlns=\"" + TARGET_NAMESPACE + "\">" + "<attrib>1</attrib>" + "<attrib>2</attrib>" + "</OtherRoot>";
    PipeRunResult prr = doPipe(pipe, input, new PipeLineSession());
    String actual = prr.getResult().asString();
    TestAssertions.assertEqualsIgnoreCRLF(expected, actual);
}
Also used : PipeRunResult(nl.nn.adapterframework.core.PipeRunResult) PipeLineSession(nl.nn.adapterframework.core.PipeLineSession) Test(org.junit.Test)

Aggregations

PipeLineSession (nl.nn.adapterframework.core.PipeLineSession)270 Message (nl.nn.adapterframework.stream.Message)210 Test (org.junit.Test)202 SenderException (nl.nn.adapterframework.core.SenderException)43 PipeRunResult (nl.nn.adapterframework.core.PipeRunResult)33 UrlMessage (nl.nn.adapterframework.stream.UrlMessage)30 ByteArrayInputStream (java.io.ByteArrayInputStream)26 IOException (java.io.IOException)25 Parameter (nl.nn.adapterframework.parameters.Parameter)23 PipeForward (nl.nn.adapterframework.core.PipeForward)21 ParameterValueList (nl.nn.adapterframework.parameters.ParameterValueList)17 Date (java.util.Date)15 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)14 InputStream (java.io.InputStream)11 TimeoutException (nl.nn.adapterframework.core.TimeoutException)11 ParameterList (nl.nn.adapterframework.parameters.ParameterList)11 Map (java.util.Map)10 SimpleDateFormat (java.text.SimpleDateFormat)9 SOAPMessage (javax.xml.soap.SOAPMessage)9 URL (java.net.URL)8