Search in sources :

Example 6 with UrlMessage

use of nl.nn.adapterframework.stream.UrlMessage in project iaf by ibissource.

the class UnzipPipeTest method testDefaultConfiguration.

@Test
public void testDefaultConfiguration() throws Exception {
    configureAndStartPipe();
    URL zip = TestFileUtils.getTestFileURL("/Unzip/input.zip");
    doPipe(new UrlMessage(zip));
    String[] files = new File(folder.getRoot().getPath()).list();
    assertEquals(6, files.length);
}
Also used : UrlMessage(nl.nn.adapterframework.stream.UrlMessage) File(java.io.File) URL(java.net.URL) Test(org.junit.Test)

Example 7 with UrlMessage

use of nl.nn.adapterframework.stream.UrlMessage in project iaf by ibissource.

the class UnzipPipeTest method testExtractAllInTheRoot.

@Test
public void testExtractAllInTheRoot() throws Exception {
    pipe.setKeepOriginalFileName(true);
    pipe.setKeepOriginalFilePath(false);
    pipe.setDeleteOnExit(false);
    configureAndStartPipe();
    URL zip = TestFileUtils.getTestFileURL("/Unzip/input.zip");
    doPipe(new UrlMessage(zip));
    String[] files = new File(folder.getRoot().getPath()).list();
    assertEquals(6, files.length);
}
Also used : UrlMessage(nl.nn.adapterframework.stream.UrlMessage) File(java.io.File) URL(java.net.URL) Test(org.junit.Test)

Example 8 with UrlMessage

use of nl.nn.adapterframework.stream.UrlMessage in project iaf by ibissource.

the class UnzipPipeTest method testUnzipCollectFileContentsBase64.

@Test
public void testUnzipCollectFileContentsBase64() throws Exception {
    pipe.setKeepOriginalFileName(true);
    pipe.setCollectFileContentsBase64Encoded(".log");
    pipe.setCollectFileContents(true);
    configureAndStartPipe();
    URL zip = TestFileUtils.getTestFileURL("/Unzip/ab.zip");
    String expected = "<results count=\"2\">" + "<result item=\"1\"><zipEntry>fileaa.txt</zipEntry><fileName>" + folder.getRoot().toString() + fileSeparator + "fileaa.txt</fileName>" + "<fileContent>aaa</fileContent>" + "</result>" + "<result item=\"2\"><zipEntry>filebb.log</zipEntry><fileName>" + folder.getRoot().toString() + fileSeparator + "filebb.log</fileName>" + "<fileContent>YmJi\n</fileContent>" + "</result>" + "</results>";
    PipeRunResult prr = doPipe(new UrlMessage(zip));
    assertXmlEquals(expected, prr.getResult().asString());
}
Also used : PipeRunResult(nl.nn.adapterframework.core.PipeRunResult) UrlMessage(nl.nn.adapterframework.stream.UrlMessage) URL(java.net.URL) Test(org.junit.Test)

Example 9 with UrlMessage

use of nl.nn.adapterframework.stream.UrlMessage in project iaf by ibissource.

the class HttpSenderTest method binaryHttpPostPDF.

@Test
public void binaryHttpPostPDF() throws Throwable {
    sender = getSender();
    URL url = TestFileUtils.getTestFileURL("/Documents/doc001.pdf");
    Message input = new UrlMessage(url);
    assertTrue("input message has to be a binary file", input.isBinary());
    PipeLineSession pls = new PipeLineSession(session);
    sender.setMethodType(HttpMethod.POST);
    sender.setContentType("application/pdf");
    sender.setPostType(PostType.BINARY);
    sender.configure();
    sender.open();
    String result = sender.sendMessage(input, pls).asString();
    assertEqualsIgnoreCRLF(getFile("binaryHttpPostPDF.txt"), result);
}
Also used : Message(nl.nn.adapterframework.stream.Message) UrlMessage(nl.nn.adapterframework.stream.UrlMessage) UrlMessage(nl.nn.adapterframework.stream.UrlMessage) PipeLineSession(nl.nn.adapterframework.core.PipeLineSession) URL(java.net.URL) Test(org.junit.Test)

Example 10 with UrlMessage

use of nl.nn.adapterframework.stream.UrlMessage in project iaf by ibissource.

the class UnzipPipeTest method testUnzipCollectFileContents.

@Test
public void testUnzipCollectFileContents() throws Exception {
    pipe.setKeepOriginalFileName(true);
    pipe.setCollectFileContents(true);
    configureAndStartPipe();
    URL zip = TestFileUtils.getTestFileURL("/Unzip/ab.zip");
    String expected = "<results count=\"2\">" + "<result item=\"1\"><zipEntry>fileaa.txt</zipEntry><fileName>" + folder.getRoot().toString() + fileSeparator + "fileaa.txt</fileName>" + "<fileContent>aaa</fileContent>" + "</result>" + "<result item=\"2\"><zipEntry>filebb.log</zipEntry><fileName>" + folder.getRoot().toString() + fileSeparator + "filebb.log</fileName>" + "<fileContent>bbb</fileContent>" + "</result>" + "</results>";
    PipeRunResult prr = doPipe(new UrlMessage(zip));
    assertXmlEquals(expected, prr.getResult().asString());
}
Also used : PipeRunResult(nl.nn.adapterframework.core.PipeRunResult) UrlMessage(nl.nn.adapterframework.stream.UrlMessage) URL(java.net.URL) Test(org.junit.Test)

Aggregations

URL (java.net.URL)12 UrlMessage (nl.nn.adapterframework.stream.UrlMessage)12 Test (org.junit.Test)12 File (java.io.File)6 PipeRunResult (nl.nn.adapterframework.core.PipeRunResult)4 PipeLineSession (nl.nn.adapterframework.core.PipeLineSession)1 Message (nl.nn.adapterframework.stream.Message)1