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());
}
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());
}
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"));
}
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);
}
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());
}
Aggregations