Search in sources :

Example 6 with MessageContext

use of nl.nn.adapterframework.stream.MessageContext in project iaf by ibissource.

the class ParameterTest method testContextKeyWithXPath.

@Test
public void testContextKeyWithXPath() throws ConfigurationException, ParameterException {
    Parameter p = new Parameter();
    p.setName("dummy");
    p.setContextKey("fakeContextKey");
    p.setXpathExpression("count(root/a)");
    p.configure();
    Message input = new Message("fakeMessage", new MessageContext().with("fakeContextKey", "<root><a/><a/></root>"));
    PipeLineSession session = new PipeLineSession();
    ParameterValueList alreadyResolvedParameters = new ParameterValueList();
    assertEquals("2", p.getValue(alreadyResolvedParameters, input, session, false));
}
Also used : Message(nl.nn.adapterframework.stream.Message) PipeLineSession(nl.nn.adapterframework.core.PipeLineSession) MessageContext(nl.nn.adapterframework.stream.MessageContext) Test(org.junit.Test)

Example 7 with MessageContext

use of nl.nn.adapterframework.stream.MessageContext in project iaf by ibissource.

the class ParameterTest method testContextKey.

@Test
public void testContextKey() throws ConfigurationException, ParameterException {
    Parameter p = new Parameter();
    p.setName("dummy");
    p.setContextKey("fakeContextKey");
    p.configure();
    Message input = new Message("fakeMessage", new MessageContext().with("fakeContextKey", "fakeContextValue"));
    PipeLineSession session = new PipeLineSession();
    ParameterValueList alreadyResolvedParameters = new ParameterValueList();
    assertEquals("fakeContextValue", p.getValue(alreadyResolvedParameters, input, session, false));
}
Also used : Message(nl.nn.adapterframework.stream.Message) PipeLineSession(nl.nn.adapterframework.core.PipeLineSession) MessageContext(nl.nn.adapterframework.stream.MessageContext) Test(org.junit.Test)

Aggregations

MessageContext (nl.nn.adapterframework.stream.MessageContext)7 Message (nl.nn.adapterframework.stream.Message)5 PipeLineSession (nl.nn.adapterframework.core.PipeLineSession)4 Test (org.junit.Test)4 IOException (java.io.IOException)2 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 Charset (java.nio.charset.Charset)1 Iterator (java.util.Iterator)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 SenderException (nl.nn.adapterframework.core.SenderException)1 XmlBuilder (nl.nn.adapterframework.util.XmlBuilder)1 CmisObject (org.apache.chemistry.opencmis.client.api.CmisObject)1 Document (org.apache.chemistry.opencmis.client.api.Document)1 Property (org.apache.chemistry.opencmis.client.api.Property)1 ContentStream (org.apache.chemistry.opencmis.commons.data.ContentStream)1 CmisObjectNotFoundException (org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException)1 ContentType (org.apache.http.entity.ContentType)1