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