Search in sources :

Example 26 with MultiPayloadAdaptrisMessage

use of com.adaptris.core.MultiPayloadAdaptrisMessage in project interlok by adaptris.

the class MultiPayloadStreamOutputParameterTest method testInsertUseDefaultId.

@Test
public void testInsertUseDefaultId() throws Exception {
    MultiPayloadMessageFactory messageFactory = new MultiPayloadMessageFactory();
    MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage) messageFactory.newMessage();
    try (InputStream in = new ByteArrayInputStream(PAYLOAD.getBytes())) {
        InputStreamWithEncoding stream = new InputStreamWithEncoding(in, ENCODING);
        MultiPayloadStreamOutputParameter parameter = new MultiPayloadStreamOutputParameter();
        parameter.insert(stream, null, message);
    }
    assertEquals(PAYLOAD, message.getContent(messageFactory.getDefaultPayloadId()));
}
Also used : MultiPayloadMessageFactory(com.adaptris.core.MultiPayloadMessageFactory) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) MultiPayloadAdaptrisMessage(com.adaptris.core.MultiPayloadAdaptrisMessage) Test(org.junit.Test)

Example 27 with MultiPayloadAdaptrisMessage

use of com.adaptris.core.MultiPayloadAdaptrisMessage in project interlok by adaptris.

the class MultiPayloadStringOutputParameterTest method testInsert.

@Test
public void testInsert() throws Exception {
    MultiPayloadStringOutputParameter parameter = new MultiPayloadStringOutputParameter();
    MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage) new MultiPayloadMessageFactory().newMessage();
    parameter.insert(PAYLOAD, ID, message);
    assertEquals(PAYLOAD, message.getContent(ID));
}
Also used : MultiPayloadMessageFactory(com.adaptris.core.MultiPayloadMessageFactory) MultiPayloadAdaptrisMessage(com.adaptris.core.MultiPayloadAdaptrisMessage) Test(org.junit.Test)

Example 28 with MultiPayloadAdaptrisMessage

use of com.adaptris.core.MultiPayloadAdaptrisMessage in project interlok by adaptris.

the class MultiPayloadStringOutputParameterTest method testInsertUseDefaultId.

@Test
public void testInsertUseDefaultId() throws Exception {
    MultiPayloadStringOutputParameter parameter = new MultiPayloadStringOutputParameter();
    MultiPayloadMessageFactory messageFactory = new MultiPayloadMessageFactory();
    MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage) messageFactory.newMessage();
    parameter.insert(PAYLOAD, null, message);
    assertEquals(PAYLOAD, message.getContent(messageFactory.getDefaultPayloadId()));
}
Also used : MultiPayloadMessageFactory(com.adaptris.core.MultiPayloadMessageFactory) MultiPayloadAdaptrisMessage(com.adaptris.core.MultiPayloadAdaptrisMessage) Test(org.junit.Test)

Example 29 with MultiPayloadAdaptrisMessage

use of com.adaptris.core.MultiPayloadAdaptrisMessage in project interlok by adaptris.

the class MultiPayloadByteArrayInputParameterTest method testExtract.

@Test
public void testExtract() throws Exception {
    MultiPayloadByteArrayInputParameter parameter = new MultiPayloadByteArrayInputParameter();
    parameter.setPayloadId(ID);
    MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage) new MultiPayloadMessageFactory().newMessage(ID, PAYLOAD);
    assertArrayEquals(PAYLOAD, parameter.extract(message));
    assertArrayEquals(PAYLOAD, parameter.extract(ID, message));
    assertArrayEquals(PAYLOAD, parameter.extract(null, message));
}
Also used : MultiPayloadMessageFactory(com.adaptris.core.MultiPayloadMessageFactory) MultiPayloadAdaptrisMessage(com.adaptris.core.MultiPayloadAdaptrisMessage) Test(org.junit.Test)

Example 30 with MultiPayloadAdaptrisMessage

use of com.adaptris.core.MultiPayloadAdaptrisMessage in project interlok by adaptris.

the class MultiPayloadByteArrayOutputParameterTest method testInsert.

@Test
public void testInsert() throws Exception {
    MultiPayloadByteArrayOutputParameter parameter = new MultiPayloadByteArrayOutputParameter();
    MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage) new MultiPayloadMessageFactory().newMessage();
    parameter.insert(PAYLOAD, ID, message);
    assertArrayEquals(PAYLOAD, message.getPayload(ID));
}
Also used : MultiPayloadMessageFactory(com.adaptris.core.MultiPayloadMessageFactory) MultiPayloadAdaptrisMessage(com.adaptris.core.MultiPayloadAdaptrisMessage) Test(org.junit.Test)

Aggregations

MultiPayloadAdaptrisMessage (com.adaptris.core.MultiPayloadAdaptrisMessage)48 Test (org.junit.Test)44 MultiPayloadMessageFactory (com.adaptris.core.MultiPayloadMessageFactory)24 ServiceException (com.adaptris.core.ServiceException)5 InputStream (java.io.InputStream)5 ByteArrayInputStream (java.io.ByteArrayInputStream)4 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)3 StxTransformerFactory (com.adaptris.util.text.xml.StxTransformerFactory)3 XsltTransformerFactory (com.adaptris.util.text.xml.XsltTransformerFactory)3 TransformerException (javax.xml.transform.TransformerException)3 KeyValuePair (com.adaptris.util.KeyValuePair)2 XPath (com.adaptris.util.text.xml.XPath)2 UncheckedXPathException (net.sf.saxon.trans.UncheckedXPathException)2 Document (org.w3c.dom.Document)2 CoreException (com.adaptris.core.CoreException)1 KeyValuePairList (com.adaptris.util.KeyValuePairList)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 ArrayList (java.util.ArrayList)1 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1