Search in sources :

Example 91 with PipeLineSession

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

the class SoapWrapperPipeTest method testWrapSoapVersionNone.

@Test
public void testWrapSoapVersionNone() throws Exception {
    pipe.setOutputNamespace(TARGET_NAMESPACE);
    pipe.setSoapVersion(SoapVersion.NONE);
    pipe.configure();
    pipe.start();
    String input = "<root>\n" + "<attrib>1</attrib>\n" + "<attrib>2</attrib>\n" + "</root>";
    String expected = "<root xmlns=\"" + TARGET_NAMESPACE + "\">\n" + "<attrib>1</attrib>\n" + "<attrib>2</attrib>\n" + "</root>";
    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 92 with PipeLineSession

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

the class SoapWrapperPipeTest method testWrap.

@Test
public void testWrap() throws Exception {
    pipe.setOutputNamespace(TARGET_NAMESPACE);
    pipe.configure();
    pipe.start();
    String input = "<root>\n" + "<attrib>1</attrib>\n" + "<attrib>2</attrib>\n" + "</root>";
    String expected = "<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>";
    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 93 with PipeLineSession

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

the class SoapWrapperPipeTest method testUnwrapRemoveNamespaces.

@Test
public void testUnwrapRemoveNamespaces() throws Exception {
    pipe.setDirection(Direction.UNWRAP);
    pipe.setRemoveOutputNamespaces(true);
    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 = "<root>\n" + "<attrib>1</attrib>\n" + "<attrib>2</attrib>\n" + "</root>";
    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 94 with PipeLineSession

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

the class SoapWrapperPipeTest method testWrapChangeRoot.

@Test
public void testWrapChangeRoot() throws Exception {
    pipe.setOutputNamespace(TARGET_NAMESPACE);
    pipe.setRoot("OtherRoot");
    pipe.configure();
    pipe.start();
    String input = "<root>\n" + "<attrib>1</attrib>\n" + "<attrib>2</attrib>\n" + "</root>";
    String expected = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><soapenv:Body>" + "<OtherRoot xmlns=\"" + TARGET_NAMESPACE + "\">" + "<attrib>1</attrib>" + "<attrib>2</attrib>" + "</OtherRoot></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 95 with PipeLineSession

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

the class SoapWrapperPipeTest method testUnwrap.

@Test
public void testUnwrap() throws Exception {
    pipe.setDirection(Direction.UNWRAP);
    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 = "<root xmlns=\"" + TARGET_NAMESPACE + "\">\n" + "<attrib>1</attrib>\n" + "<attrib>2</attrib>\n" + "</root>";
    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