use of com.adaptris.core.MultiPayloadAdaptrisMessage in project interlok by adaptris.
the class MultiPayloadXmlTransformServiceTest method testObtainUrlWithUrlOnly.
@Test
public void testObtainUrlWithUrlOnly() throws Exception {
MultiPayloadXmlTransformService service = new MultiPayloadXmlTransformService();
MultiPayloadAdaptrisMessage msg = (MultiPayloadAdaptrisMessage) new MultiPayloadMessageFactory().newMessage();
try {
service.setUrl(URL);
LifecycleHelper.init(service);
assertEquals(URL, service.obtainUrlToUse(msg));
} finally {
LifecycleHelper.close(service);
}
}
use of com.adaptris.core.MultiPayloadAdaptrisMessage in project interlok by adaptris.
the class MultiPayloadXmlTransformServiceTest method testXSLTOutput.
@Test
public void testXSLTOutput() throws Exception {
MultiPayloadAdaptrisMessage m1 = MessageHelper.createMultiPayloadMessage(PAYLOAD_ID_SOURCE, PROPERTIES.getProperty(KEY_XML_TEST_INPUT));
MultiPayloadXmlTransformService service = createBaseExample();
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 testResolvableExpressionParameter_XSLTOutput.
@Test
public void testResolvableExpressionParameter_XSLTOutput() throws Exception {
MultiPayloadAdaptrisMessage message = MessageHelper.createMultiPayloadMessage(PAYLOAD_ID_SOURCE, PROPERTIES.getProperty(KEY_XML_TEST_INPUT));
message.addPayload("somePayload", "World".getBytes());
MultiPayloadXmlTransformService service = createBaseExample();
ResolvableExpressionParameter params = new ResolvableExpressionParameter();
KeyValuePairList exprns = new KeyValuePairList();
exprns.add(new KeyValuePair("world", "%payload{id:somePayload}"));
params.setExpressions(exprns);
service.setTransformParameter(params);
execute(service, message);
assertEquals(PROPERTIES.getProperty(KEY_XML_TEST_OUTPUT) + "World", message.getContent(PAYLOAD_ID_OUTPUT));
}
use of com.adaptris.core.MultiPayloadAdaptrisMessage in project interlok by adaptris.
the class MultiPayloadXmlTransformServiceTest method testRemoveNamespaceMapping.
@Test
public void testRemoveNamespaceMapping() throws Exception {
// This explicit tests some behavioural changes that might have occurred due to migration SaxonHE
MultiPayloadXmlTransformService service = createBaseExample();
service.setOutputMessageEncoding("ISO-8859-1");
MultiPayloadAdaptrisMessage msg = (MultiPayloadAdaptrisMessage) new MultiPayloadMessageFactory().newMessage(PAYLOAD_ID_SOURCE, XML_WITH_NAMESPACE, "UTF-8");
execute(service, msg);
log.debug(msg.getContent());
}
use of com.adaptris.core.MultiPayloadAdaptrisMessage in project interlok by adaptris.
the class MultiPayloadXmlTransformServiceTest method testObjectMetadataParameter_XSLTOutput.
@Test
public void testObjectMetadataParameter_XSLTOutput() throws Exception {
MultiPayloadAdaptrisMessage msg = MessageHelper.createMultiPayloadMessage(PAYLOAD_ID_SOURCE, PROPERTIES.getProperty(KEY_XML_TEST_INPUT));
msg.addObjectHeader("myDocumentObject", XmlHelper.createDocument("<data>World</data>"));
msg.addObjectHeader("anotherDocument", XmlHelper.createDocument("<data>GoodBye</data>"));
MultiPayloadXmlTransformService service = createBaseExample();
service.setUrl(PROPERTIES.getProperty(KEY_XML_NODE_TRANSFORM_URL));
service.setTransformParameter(new ObjectMetadataParameter(".*my.*"));
execute(service, msg);
assertEquals(PROPERTIES.getProperty(KEY_XML_TEST_OUTPUT) + "World", msg.getContent(PAYLOAD_ID_OUTPUT));
}
Aggregations