use of nl.nn.adapterframework.core.PipeRunResult in project iaf by ibissource.
the class StreamPipeTest method doPipeHttpRequestTest.
@Test
public void doPipeHttpRequestTest() throws Exception {
StreamPipe streamPipe = new StreamPipe();
streamPipe.registerForward(createPipeSuccessForward());
MockMultipartHttpServletRequest request = createMultipartHttpRequest();
streamPipe.addParameter(createHttpRequestParameter(request, session));
streamPipe.configure();
PipeRunResult pipeRunResult = streamPipe.doPipe("", session);
assertEquals("success", pipeRunResult.getPipeForward().getName());
String expectedResult = "<parts>" + "<part type=\"string\" name=\"string1\" sessionKey=\"part_string\" size=\"19\"/>" + "<part type=\"file\" name=\"doc001.pdf\" sessionKey=\"part_file\" size=\"26358\" mimeType=\"application/octet-stream; charset=ISO-8859-1\"/>" + "<part type=\"file\" name=\"doc002.pdf\" sessionKey=\"part_file2\" size=\"25879\" mimeType=\"application/octet-stream; charset=ISO-8859-1\"/>" + "</parts>";
assertEquals(expectedResult, pipeRunResult.getResult());
}
use of nl.nn.adapterframework.core.PipeRunResult in project iaf by ibissource.
the class StreamPipeTest method doPipeHttpRequestAntiVirusTest.
@Test
public void doPipeHttpRequestAntiVirusTest() throws Exception {
StreamPipe streamPipe = new StreamPipe();
streamPipe.registerForward(createPipeSuccessForward());
MockMultipartHttpServletRequest request = createMultipartHttpRequest(streamPipe, true);
streamPipe.addParameter(createHttpRequestParameter(request, session));
streamPipe.configure();
PipeRunResult pipeRunResult = streamPipe.doPipe("", session);
assertEquals("success", pipeRunResult.getPipeForward().getName());
String expectedResult = "<parts>" + "<part type=\"string\" name=\"string1\" sessionKey=\"part_string\" size=\"19\"/>" + "<part type=\"file\" name=\"doc001.pdf\" sessionKey=\"part_file\" size=\"26358\" mimeType=\"application/octet-stream; charset=ISO-8859-1\"/>" + "<part type=\"string\" name=\"antivirus_rc\" sessionKey=\"part_string2\" size=\"4\"/>" + "<part type=\"file\" name=\"doc002.pdf\" sessionKey=\"part_file2\" size=\"25879\" mimeType=\"application/octet-stream; charset=ISO-8859-1\"/>" + "<part type=\"string\" name=\"antivirus_rc\" sessionKey=\"part_string3\" size=\"4\"/>" + "</parts>";
assertEquals(expectedResult, pipeRunResult.getResult());
}
use of nl.nn.adapterframework.core.PipeRunResult in project iaf by ibissource.
the class HashPipeTest method md5.
@Test
public void md5() throws ConfigurationException, PipeStartException, IOException, PipeRunException {
pipe.setSecret("Potato");
pipe.setAlgorithm("HmacMD5");
pipe.configure();
pipe.start();
PipeRunResult prr = pipe.doPipe("hash me plz", session);
String hash = (String) prr.getResult();
assertEquals("TwGD5U8BwKoLn8u/F+4R/g==", hash);
}
use of nl.nn.adapterframework.core.PipeRunResult in project iaf by ibissource.
the class Json2WsdlXmlValidatorTest method validate.
public void validate(String description, WsdlXmlValidator val, String input, String outputFormat, boolean compactJsonArrays, String targetContent1, String targetContent2) {
val.setCompactJsonArrays(compactJsonArrays);
if (compactJsonArrays) {
description += " (compact)";
} else {
description += " (straight)";
}
System.out.println("-- " + description + " --");
System.out.println("input [" + input + "]");
if (outputFormat != null) {
session.put("outputFormat", outputFormat);
} else {
session.remove("outputFormat");
}
PipeRunResult result;
try {
result = val.doPipe(input, session);
String resultStr = (String) result.getResult();
System.out.println("result of [" + description + "]\n" + resultStr);
if (resultStr.indexOf(targetContent1) < 0) {
fail("result of [" + description + "] does not contain target content [" + targetContent1 + "]");
}
if (resultStr.indexOf(targetContent2) < 0) {
fail("result of [" + description + "] does not contain target content [" + targetContent2 + "]");
}
// if ("xml".equals(outputFormat)) {
// result=val.doPipe(resultStr, session);
// resultStr=(String)result.getResult();
// System.out.println("back to json:"+resultStr);
// }
} catch (PipeRunException e) {
e.printStackTrace();
fail(description + ": " + e.getMessage());
}
}
Aggregations