use of nl.nn.adapterframework.core.PipeLineSession in project iaf by ibissource.
the class ParameterTest method testFixedDateWithSessionFromTesttool.
@Test
public void testFixedDateWithSessionFromTesttool() throws Exception {
Parameter p = new Parameter();
p.setName("date");
p.setPattern("{fixedDate}");
p.setType(ParameterType.DATE);
p.configure();
PipeLineSession session = new PipeLineSession();
session.put("stub4testtool.fixeddate", "1996-02-24");
ParameterValueList alreadyResolvedParameters = new ParameterValueList();
Message message = new Message("fakeMessage");
try {
System.setProperty(ConfigurationUtils.STUB4TESTTOOL_CONFIGURATION_KEY, "true");
Object result = p.getValue(alreadyResolvedParameters, message, session, false);
assertTrue(result instanceof Date);
Date resultDate = (Date) result;
SimpleDateFormat sdf = new SimpleDateFormat(Parameter.TYPE_DATE_PATTERN);
String formattedDate = sdf.format(resultDate);
assertEquals("1996-02-24", formattedDate);
} finally {
System.setProperty(ConfigurationUtils.STUB4TESTTOOL_CONFIGURATION_KEY, "false");
}
}
use of nl.nn.adapterframework.core.PipeLineSession in project iaf by ibissource.
the class SoapProviderTest method receiveMessageWithAttachmentsTest.
@Test
public /**
* Receive SOAP message with MTOM attachment
* Reply SOAP message without attachment
* @throws Throwable
*/
void receiveMessageWithAttachmentsTest() throws Throwable {
SOAPMessage request = createMessage("correct-soapmsg.xml", true, false);
SOAPMessage message = SOAPProvider.invoke(request);
String result = XmlUtils.nodeToString(message.getSOAPPart());
String expected = Misc.streamToString(getFile("correct-soapmsg.xml"));
assertEquals(expected.replaceAll("\r", ""), result.replaceAll("\r", ""));
PipeLineSession session = SOAPProvider.getSession();
assertAttachmentInSession(session);
}
use of nl.nn.adapterframework.core.PipeLineSession in project iaf by ibissource.
the class SoapProviderTest method simpleMessageTest.
@Test
public /**
* Receive SOAP message without attachment
* Reply SOAP message without attachment
* @throws Throwable
*/
void simpleMessageTest() throws Throwable {
SOAPMessage request = createMessage("correct-soapmsg.xml");
SOAPMessage message = SOAPProvider.invoke(request);
String result = XmlUtils.nodeToString(message.getSOAPPart());
String expected = Misc.streamToString(getFile("correct-soapmsg.xml"));
assertEquals(expected.replaceAll("\r", ""), result.replaceAll("\r", ""));
PipeLineSession session = SOAPProvider.getSession();
assertNotNull(session.get("mimeHeaders"));
assertNotNull(session.get("attachments"));
assertEquals("<attachments/>", session.get("attachments").toString().trim());
}
use of nl.nn.adapterframework.core.PipeLineSession in project iaf by ibissource.
the class GetFromSessionTest method populateSession.
@Before
public void populateSession() {
session = new PipeLineSession();
session.put("dummyString", DUMMY_DATA);
session.put("dummyByteArray", DUMMY_DATA.getBytes());
session.put("dummyStream", new ByteArrayInputStream(DUMMY_DATA.getBytes()));
session.put("emptyMap", new HashMap<String, String>());
Map<String, String> map = new HashMap<String, String>();
map.put("key1", "value1");
map.put("key2", "value2");
session.put("map", map);
}
use of nl.nn.adapterframework.core.PipeLineSession in project iaf by ibissource.
the class MessageSendingPipeTest method createPipe.
@Override
public MessageSendingPipe createPipe() throws ConfigurationException {
MessageSendingPipe result = new MessageSendingPipe();
result.setSender(new EchoSender() {
@Override
public Message sendMessage(Message message, PipeLineSession session) throws SenderException, TimeoutException {
try {
return new Message("{ \"input\": \"" + message.asString() + "\"}");
} catch (IOException e) {
throw new SenderException(e);
}
}
});
return result;
}
Aggregations