use of nl.nn.adapterframework.core.PipeLineSession in project iaf by ibissource.
the class MultipartHttpSenderTest method simpleMockedMultipartHttp1.
@Test
public void simpleMockedMultipartHttp1() throws Throwable {
MultipartHttpSender sender = getSender();
Message input = new Message("<xml>input</xml>");
try {
PipeLineSession pls = new PipeLineSession(session);
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("simpleMockedMultipartHttp1.txt"), result.trim());
} catch (SenderException e) {
throw e.getCause();
} finally {
if (sender != null) {
sender.close();
}
}
}
use of nl.nn.adapterframework.core.PipeLineSession in project iaf by ibissource.
the class MultipartHttpSenderTest method simpleMockedMultipartHttp2.
@Test
public void simpleMockedMultipartHttp2() throws Throwable {
MultipartHttpSender sender = getSender();
Message input = new Message("<xml>input</xml>");
try {
PipeLineSession pls = new PipeLineSession(session);
String xmlMultipart = "<parts><part name=\"dummy\" filename=\"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("simpleMockedMultipartHttp2.txt"), result.trim());
} catch (SenderException e) {
throw e.getCause();
} finally {
if (sender != null) {
sender.close();
}
}
}
use of nl.nn.adapterframework.core.PipeLineSession in project iaf by ibissource.
the class MultipartHttpSenderTest method simpleMockedMultipartMtom2.
@Test
public void simpleMockedMultipartMtom2() throws Throwable {
MultipartHttpSender sender = getSender();
Message input = new Message("<xml>input</xml>");
try {
PipeLineSession pls = new PipeLineSession(session);
String xmlMultipart = "<parts><part name=\"dummy\" filename=\"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("simpleMockedMultipartMtom2.txt"), result.trim());
} catch (SenderException e) {
throw e.getCause();
} finally {
if (sender != null) {
sender.close();
}
}
}
use of nl.nn.adapterframework.core.PipeLineSession in project iaf by ibissource.
the class RestSenderTest method simpleMockedHttpPost.
@Test
public void simpleMockedHttpPost() throws Throwable {
// Cannot add headers (aka parameters) for this test!
RestSender sender = getSender(false);
Message input = new Message("hallo this is my message");
PipeLineSession pls = new PipeLineSession(session);
// should handle both upper and lowercase methodtypes :)
sender.setMethodType(HttpMethod.POST);
sender.configure();
sender.open();
String result = sender.sendMessage(input, pls).asString().replaceAll("
", "\r");
assertEqualsIgnoreCRLF(getFile("simpleMockedRestPost.txt"), result.trim());
}
use of nl.nn.adapterframework.core.PipeLineSession in project iaf by ibissource.
the class WebServiceSenderTest method simpleMockedWss.
@Test
public void simpleMockedWss() throws Throwable {
WebServiceSender sender = getSender();
Message input = new Message("<hallo/>");
try {
PipeLineSession pls = new PipeLineSession(session);
sender.configure();
sender.open();
String result = sender.sendMessage(input, pls).asString();
assertEqualsIgnoreCRLF(getFile("simpleMockedWss.txt"), result.trim());
} catch (SenderException e) {
throw e.getCause();
}
}
Aggregations