use of nl.nn.adapterframework.core.PipeLineSession in project iaf by ibissource.
the class HttpSenderTest method paramsWithoutValue.
@Test
public void paramsWithoutValue() throws Throwable {
sender = getSender();
Message input = new Message("paramterValue");
PipeLineSession pls = new PipeLineSession(session);
sender.addParameter(new Parameter("url", "http://127.0.0.1/value%2Fvalue?emptyParam"));
sender.addParameter(new Parameter("myParam", ""));
sender.setMethodType(HttpMethod.GET);
sender.configure();
sender.open();
String result = sender.sendMessage(input, pls).asString();
assertEqualsIgnoreCRLF(getFile("paramsWithoutValue.txt"), result.trim());
}
use of nl.nn.adapterframework.core.PipeLineSession in project iaf by ibissource.
the class HttpSenderTest method binaryHttpPostJSON.
@Test
public void binaryHttpPostJSON() throws Throwable {
sender = getSender();
// Let's pretend this is a big JSON stream!
Message input = new Message(new ByteArrayInputStream("{\"key1\": \"value2\"}".getBytes()));
assertTrue("input message has to be of type binary", input.isBinary());
PipeLineSession pls = new PipeLineSession(session);
sender.setMethodType(HttpMethod.POST);
sender.setContentType("application/json");
sender.setPostType(PostType.BINARY);
sender.configure();
sender.open();
String result = sender.sendMessage(input, pls).asString();
assertEqualsIgnoreCRLF(getFile("binaryHttpPostJSON.txt"), result);
}
use of nl.nn.adapterframework.core.PipeLineSession in project iaf by ibissource.
the class HttpSenderTest method specialCharactersInURLParam.
@Test
public void specialCharactersInURLParam() throws Throwable {
sender = getSender();
Message input = new Message("hallo");
PipeLineSession pls = new PipeLineSession(session);
sender.addParameter(new Parameter("url", "http://127.0.0.1/value%20value?param=Hello%20G%C3%BCnter"));
sender.addParameter(new Parameter("otherKey", "otherValue"));
sender.setMethodType(HttpMethod.GET);
sender.configure();
sender.open();
String result = sender.sendMessage(input, pls).asString();
assertEqualsIgnoreCRLF(getFile("specialCharactersInURLParam.txt"), result.trim());
}
use of nl.nn.adapterframework.core.PipeLineSession in project iaf by ibissource.
the class HttpSenderTest method simpleMockedHttpUnknownHeaderParam.
@Test
public void simpleMockedHttpUnknownHeaderParam() throws Throwable {
sender = getSender();
Message input = new Message("hallo");
PipeLineSession pls = new PipeLineSession(session);
sender.addParameter(new Parameter("key", "value"));
sender.addParameter(new Parameter("otherKey", "otherValue"));
sender.setMethodType(HttpMethod.GET);
sender.setHeadersParams("custom-header, doesn-t-exist");
sender.configure();
sender.open();
String result = sender.sendMessage(input, pls).asString();
assertEqualsIgnoreCRLF(getFile("simpleMockedHttpGetWithParams.txt"), result.trim());
}
use of nl.nn.adapterframework.core.PipeLineSession in project iaf by ibissource.
the class HttpSenderTest method simpleMockedHttpPost.
@Test
public void simpleMockedHttpPost() throws Throwable {
// Cannot add headers (aka parameters) for this test!
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();
assertEqualsIgnoreCRLF(getFile("simpleMockedHttpPost.txt"), result.trim());
}
Aggregations