use of nl.nn.adapterframework.core.PipeLineSession in project iaf by ibissource.
the class WebServiceSenderTest method simpleMockedWssMultipart.
@Test
public void simpleMockedWssMultipart() throws Throwable {
WebServiceSender sender = getSender();
Message input = new Message("<xml>input</xml>");
try {
PipeLineSession pls = new PipeLineSession(session);
sender.setMethodType(HttpMethod.POST);
sender.setParamsInUrl(false);
sender.setInputMessageParam("request");
String xmlMultipart = "<parts><part type=\"file\" name=\"document.pdf\" " + "sessionKey=\"part_file\" size=\"72833\" " + "mimeType=\"application/pdf\"/></parts>";
pls.put("multipartXml", xmlMultipart);
pls.put("part_file", new ByteArrayInputStream("<dummy xml file/>".getBytes()));
sender.setMultipartXmlSessionKey("multipartXml");
sender.configure();
sender.open();
String result = sender.sendMessage(input, pls).asString();
;
assertEqualsIgnoreCRLF(getFile("simpleMockedWssMultipart.txt"), result.trim());
} catch (SenderException e) {
throw e.getCause();
}
}
use of nl.nn.adapterframework.core.PipeLineSession in project iaf by ibissource.
the class WebServiceSenderTest method simpleMockedWssMultipart2.
@Test
public void simpleMockedWssMultipart2() throws Throwable {
WebServiceSender sender = getSender();
Message input = new Message("<xml>input</xml>");
try {
PipeLineSession pls = new PipeLineSession(session);
sender.setMethodType(HttpMethod.POST);
sender.setParamsInUrl(false);
sender.setInputMessageParam("request");
String xmlMultipart = "<parts>" + "<part type=\"file\" name=\"document1.pdf\" sessionKey=\"part_file1\" mimeType=\"application/pdf\"/>" + "<part type=\"file\" name=\"document2.pdf\" sessionKey=\"part_file2\" mimeType=\"application/pdf\"/>" + "</parts>";
pls.put("multipartXml", xmlMultipart);
pls.put("part_file1", new ByteArrayInputStream("<dummy pdf file/>".getBytes()));
pls.put("part_file2", new ByteArrayInputStream("<dummy pdf file/>".getBytes()));
sender.setMultipartXmlSessionKey("multipartXml");
sender.configure();
sender.open();
String result = sender.sendMessage(input, pls).asString();
;
assertEqualsIgnoreCRLF(getFile("simpleMockedWssMultipart2.txt"), result.trim());
} catch (SenderException e) {
throw e.getCause();
}
}
use of nl.nn.adapterframework.core.PipeLineSession in project iaf by ibissource.
the class WebServiceSenderTest method simpleMockedWssMtom.
@Test
public void simpleMockedWssMtom() throws Throwable {
WebServiceSender sender = getSender();
Message input = new Message("<xml>input</xml>");
try {
PipeLineSession pls = new PipeLineSession(session);
sender.setMethodType(HttpMethod.POST);
sender.setParamsInUrl(false);
sender.setInputMessageParam("request");
String xmlMultipart = "<parts><part type=\"file\" name=\"document.pdf\" " + "sessionKey=\"part_file\" size=\"72833\" " + "mimeType=\"application/pdf\"/></parts>";
pls.put("multipartXml", xmlMultipart);
pls.put("part_file", new ByteArrayInputStream("<dummy xml file/>".getBytes()));
sender.setMtomEnabled(true);
sender.setMultipartXmlSessionKey("multipartXml");
sender.configure();
sender.open();
String result = sender.sendMessage(input, pls).asString();
assertEqualsIgnoreCRLF(getFile("simpleMockedWssMtom.txt"), result.trim());
} catch (SenderException e) {
throw e.getCause();
}
}
use of nl.nn.adapterframework.core.PipeLineSession in project iaf by ibissource.
the class HttpSenderTest method simpleMockedHttpGet.
@Test
public void simpleMockedHttpGet() throws Throwable {
// Cannot add headers (aka parameters) for this test!
sender = getSender(false);
Message input = new Message("hallo");
PipeLineSession pls = new PipeLineSession(session);
sender.setMethodType(HttpMethod.GET);
sender.configure();
sender.open();
String result = sender.sendMessage(input, pls).asString();
assertEqualsIgnoreCRLF(getFile("simpleMockedHttpGet.txt"), result.trim());
}
use of nl.nn.adapterframework.core.PipeLineSession in project iaf by ibissource.
the class HttpSenderTest method simpleMockedHttpPostAppendParamsToBodyAndEmptyBody.
@Test
public void simpleMockedHttpPostAppendParamsToBodyAndEmptyBody() throws Throwable {
// Cannot add headers (aka parameters) for this test!
sender = getSender(false);
sender.setUrl("http://127.0.0.1/something&dummy=true");
Message input = new Message("");
PipeLineSession pls = new PipeLineSession(session);
// should handle both upper and lowercase methodtypes :)
sender.setMethodType(HttpMethod.POST);
sender.addParameter(new Parameter("key", "value"));
sender.addParameter(new Parameter("otherKey", "otherValue"));
sender.configure();
sender.open();
String result = sender.sendMessage(input, pls).asString();
assertEqualsIgnoreCRLF(getFile("simpleMockedHttpPostAppendParamsToBodyAndEmptyBody.txt"), result.trim());
}
Aggregations