use of com.adaptris.core.MultiPayloadMessageFactory in project interlok by adaptris.
the class MultiPayloadMessageSplitterTest method setUp.
@Before
public void setUp() throws Exception {
splitter = createSplitterForTests();
message = (MultiPayloadAdaptrisMessage) new MultiPayloadMessageFactory().newMessage(ID_1, PAYLOAD_1, "UTF-8");
message.addContent(ID_2, PAYLOAD_2);
}
use of com.adaptris.core.MultiPayloadMessageFactory in project interlok by adaptris.
the class MultiPayloadStreamOutputParameterTest method testInsertSetId.
@Test
public void testInsertSetId() throws Exception {
MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage) new MultiPayloadMessageFactory().newMessage();
try (InputStream in = new ByteArrayInputStream(PAYLOAD.getBytes())) {
InputStreamWithEncoding stream = new InputStreamWithEncoding(in, ENCODING);
MultiPayloadStreamOutputParameter parameter = new MultiPayloadStreamOutputParameter();
parameter.setPayloadId(ID);
parameter.insert(stream, message);
}
assertEquals(PAYLOAD, message.getContent(ID));
}
use of com.adaptris.core.MultiPayloadMessageFactory in project interlok by adaptris.
the class MultiPayloadStreamOutputParameterTest method testInsertNoEncoding.
@Test
public void testInsertNoEncoding() throws Exception {
MultiPayloadMessageFactory messageFactory = new MultiPayloadMessageFactory();
MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage) messageFactory.newMessage();
try (InputStream in = new ByteArrayInputStream(PAYLOAD.getBytes())) {
InputStreamWithEncoding stream = new InputStreamWithEncoding(in, null);
MultiPayloadStreamOutputParameter parameter = new MultiPayloadStreamOutputParameter();
parameter.setContentEncoding(null);
parameter.insert(stream, ID, message);
}
assertEquals(PAYLOAD, message.getContent(ID));
}
use of com.adaptris.core.MultiPayloadMessageFactory in project interlok by adaptris.
the class MultiPayloadStringInputParameterTest method testExtract.
@Test
public void testExtract() throws Exception {
MultiPayloadStringInputParameter parameter = new MultiPayloadStringInputParameter();
parameter.setPayloadId(ID);
MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage) new MultiPayloadMessageFactory().newMessage(ID, PAYLOAD, ENCODING);
assertEquals(PAYLOAD, parameter.extract(message));
assertEquals(PAYLOAD, parameter.extract(ID, message));
assertEquals(PAYLOAD, parameter.extract(null, message));
}
use of com.adaptris.core.MultiPayloadMessageFactory in project interlok by adaptris.
the class MultiPayloadStringOutputParameterTest method testInsertSetId.
@Test
public void testInsertSetId() throws Exception {
MultiPayloadStringOutputParameter parameter = new MultiPayloadStringOutputParameter();
parameter.setPayloadId(ID);
MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage) new MultiPayloadMessageFactory().newMessage();
parameter.insert(PAYLOAD, message);
assertEquals(PAYLOAD, message.getContent(ID));
}
Aggregations