use of com.adaptris.core.MultiPayloadAdaptrisMessage in project interlok by adaptris.
the class MultiPayloadByteArrayOutputParameterTest method testInsertUseDefaultId.
@Test
public void testInsertUseDefaultId() throws Exception {
MultiPayloadByteArrayOutputParameter parameter = new MultiPayloadByteArrayOutputParameter();
MultiPayloadMessageFactory messageFactory = new MultiPayloadMessageFactory();
MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage) messageFactory.newMessage();
parameter.insert(PAYLOAD, null, message);
assertArrayEquals(PAYLOAD, message.getPayload(messageFactory.getDefaultPayloadId()));
}
use of com.adaptris.core.MultiPayloadAdaptrisMessage in project interlok by adaptris.
the class MultiPayloadByteArrayOutputParameterTest method testInsertSetId.
@Test
public void testInsertSetId() throws Exception {
MultiPayloadByteArrayOutputParameter parameter = new MultiPayloadByteArrayOutputParameter();
parameter.setPayloadId(ID);
MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage) new MultiPayloadMessageFactory().newMessage();
parameter.insert(PAYLOAD, message);
assertArrayEquals(PAYLOAD, message.getPayload(ID));
}
use of com.adaptris.core.MultiPayloadAdaptrisMessage in project interlok by adaptris.
the class MultiPayloadXmlTransformServiceTest method testSTXOutput.
@Test
public void testSTXOutput() throws Exception {
MultiPayloadAdaptrisMessage m1 = MessageHelper.createMultiPayloadMessage(PAYLOAD_ID_SOURCE, PROPERTIES.getProperty(KEY_XML_TEST_INPUT));
MultiPayloadXmlTransformService service = createBaseExample();
service.setUrl(PROPERTIES.getProperty(KEY_XML_TEST_STX_TRANSFORM_URL));
service.setXmlTransformerFactory(new StxTransformerFactory());
execute(service, m1);
assertEquals(PROPERTIES.getProperty(KEY_XML_TEST_OUTPUT), m1.getContent(PAYLOAD_ID_OUTPUT));
}
use of com.adaptris.core.MultiPayloadAdaptrisMessage in project interlok by adaptris.
the class MultiPayloadXmlTransformServiceTest method testIssue2641_NoOutputMessageEncoding.
@Test
public void testIssue2641_NoOutputMessageEncoding() throws Exception {
MultiPayloadAdaptrisMessage msg = MessageHelper.createMultiPayloadMessage(PAYLOAD_ID_SOURCE, PROPERTIES.getProperty(KEY_ISSUE2641_INPUT), "ISO-8859-1");
Document srcXml = createDocument(msg.getPayload(PAYLOAD_ID_SOURCE));
XPath srcXpath = new XPath();
String srcValue = srcXpath.selectSingleTextItem(srcXml, ISSUE2641_SRC_XPATH);
assertEquals("ISO-8859-1", msg.getContentEncoding());
MultiPayloadXmlTransformService service = createBaseExample();
service.setUrl(PROPERTIES.getProperty(KEY_ISSUE2641_TRANSFORM_URL));
execute(service, msg);
assertEquals("ISO-8859-1", msg.getContentEncoding());
// We're using UTF-8 as the encoding; get bytes will give us the right thing.
Document destXml = createDocument(msg.getPayload(PAYLOAD_ID_OUTPUT));
XPath destXpath = new XPath();
String destValue = destXpath.selectSingleTextItem(destXml, ISSUE2641_DEST_XPATH);
log.debug("testIssue2641:: srcValue = [" + srcValue + "]");
log.debug("testIssue2641:: destValue = [" + destValue + "]");
// All things being equal, they should be the same.
assertEquals(srcValue, destValue);
}
use of com.adaptris.core.MultiPayloadAdaptrisMessage in project interlok by adaptris.
the class MultiPayloadXmlTransformServiceTest method testXSLTOutput_NamedXsltTransformFactory.
@Test
public void testXSLTOutput_NamedXsltTransformFactory() throws Exception {
MultiPayloadAdaptrisMessage m1 = MessageHelper.createMultiPayloadMessage(PAYLOAD_ID_SOURCE, PROPERTIES.getProperty(KEY_XML_TEST_INPUT));
MultiPayloadXmlTransformService service = createBaseExample();
XsltTransformerFactory fac = new XsltTransformerFactory(net.sf.saxon.TransformerFactoryImpl.class.getCanonicalName());
service.setXmlTransformerFactory(fac);
execute(service, m1);
assertEquals(PROPERTIES.getProperty(KEY_XML_TEST_OUTPUT), m1.getContent(PAYLOAD_ID_OUTPUT));
}
Aggregations