Search in sources :

Example 1 with UrlMessage

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

the class UnzipPipeTest method testUnzipFromStream.

@Test
public void testUnzipFromStream() throws Exception {
    pipe.setKeepOriginalFileName(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></result>" + "<result item=\"2\"><zipEntry>filebb.log</zipEntry><fileName>" + folder.getRoot().toString() + fileSeparator + "filebb.log</fileName></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 2 with UrlMessage

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

the class UnzipPipeTest method testUnzipNoCollectResults.

@Test
public void testUnzipNoCollectResults() throws Exception {
    pipe.setKeepOriginalFileName(true);
    pipe.setCollectResults(false);
    configureAndStartPipe();
    URL zip = TestFileUtils.getTestFileURL("/Unzip/ab.zip");
    String expected = "<results count=\"2\">" + "</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 3 with UrlMessage

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

the class UnzipPipeTest method testCreateSubDirectories.

@Test
public void testCreateSubDirectories() throws Exception {
    pipe.setKeepOriginalFilePath(true);
    configureAndStartPipe();
    URL zip = TestFileUtils.getTestFileURL("/Unzip/folder.zip");
    doPipe(new UrlMessage(zip));
    String[] files = new File(folder.getRoot() + "/Folder/innerFolder").list();
    assertEquals(1, files.length);
    assertTrue(files[0].contains("innerFile"));
}
Also used : UrlMessage(nl.nn.adapterframework.stream.UrlMessage) File(java.io.File) URL(java.net.URL) Test(org.junit.Test)

Example 4 with UrlMessage

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

the class UnzipPipeTest method testCreateSubDirectoriesInnerItemAsTheFirstEntry.

@Test
public void testCreateSubDirectoriesInnerItemAsTheFirstEntry() throws Exception {
    pipe.setKeepOriginalFilePath(true);
    configureAndStartPipe();
    URL zip = TestFileUtils.getTestFileURL("/Unzip/input.zip");
    doPipe(new UrlMessage(zip));
    String[] files = new File(folder.getRoot() + "/MyProjects/").list();
    assertEquals(5, files.length);
    files = new File(folder.getRoot() + "/MyProjects/classes/xml/xsl/").list();
    assertEquals(2, files.length);
}
Also used : UrlMessage(nl.nn.adapterframework.stream.UrlMessage) File(java.io.File) URL(java.net.URL) Test(org.junit.Test)

Example 5 with UrlMessage

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

the class UnzipPipeTest method testCreateSubDirectoriesKeepFilenameDeleteOnExit.

@Test
public void testCreateSubDirectoriesKeepFilenameDeleteOnExit() throws Exception {
    pipe.setKeepOriginalFileName(true);
    pipe.setKeepOriginalFilePath(true);
    configureAndStartPipe();
    URL zip = TestFileUtils.getTestFileURL("/Unzip/folder.zip");
    doPipe(new UrlMessage(zip));
    File toBePresent = new File(folder.getRoot() + "/Folder/innerFolder/innerFile.txt");
    assertTrue(toBePresent.exists());
}
Also used : UrlMessage(nl.nn.adapterframework.stream.UrlMessage) File(java.io.File) 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