use of com.adaptris.core.MultiPayloadAdaptrisMessage in project interlok by adaptris.
the class MultiPayloadXmlTransformServiceTest method testObjectMetadataParameter_NoRegexp.
@Test
public void testObjectMetadataParameter_NoRegexp() 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());
try {
execute(service, msg);
fail();
} catch (ServiceException expected) {
// expected
}
}
use of com.adaptris.core.MultiPayloadAdaptrisMessage in project interlok by adaptris.
the class MultiPayloadXmlTransformServiceTest method testOutputWithCache.
@Test
public void testOutputWithCache() throws Exception {
MultiPayloadAdaptrisMessage m1 = MessageHelper.createMultiPayloadMessage(PAYLOAD_ID_SOURCE, PROPERTIES.getProperty(KEY_XML_TEST_INPUT));
MultiPayloadAdaptrisMessage m2 = MessageHelper.createMultiPayloadMessage(PAYLOAD_ID_SOURCE, PROPERTIES.getProperty(KEY_XML_TEST_INPUT));
MultiPayloadXmlTransformService service = createBaseExample();
try {
start(service);
service.doService(m1);
service.doService(m2);
assertEquals(PROPERTIES.getProperty(KEY_XML_TEST_OUTPUT), m1.getContent(PAYLOAD_ID_OUTPUT));
assertEquals(PROPERTIES.getProperty(KEY_XML_TEST_OUTPUT), m2.getContent(PAYLOAD_ID_OUTPUT));
} finally {
stop(service);
}
}
use of com.adaptris.core.MultiPayloadAdaptrisMessage in project interlok by adaptris.
the class MultiPayloadXmlTransformServiceTest method testSingleParameter_XSLTOutput.
@Test
public void testSingleParameter_XSLTOutput() throws Exception {
MultiPayloadAdaptrisMessage msg = MessageHelper.createMultiPayloadMessage(PAYLOAD_ID_SOURCE, PROPERTIES.getProperty(KEY_XML_TEST_INPUT));
msg.addMetadata("world", "World");
MultiPayloadXmlTransformService service = createBaseExample();
service.setTransformParameter(new StringMetadataParameter());
execute(service, msg);
assertEquals(PROPERTIES.getProperty(KEY_XML_TEST_OUTPUT) + "World", msg.getContent(PAYLOAD_ID_OUTPUT));
}
use of com.adaptris.core.MultiPayloadAdaptrisMessage in project interlok by adaptris.
the class MultiPayloadXmlTransformServiceTest method testParameterBuilder_ObjectMetadata_XSLTOutput.
@Test
public void testParameterBuilder_ObjectMetadata_XSLTOutput() throws Exception {
MultiPayloadAdaptrisMessage msg = MessageHelper.createMultiPayloadMessage(PAYLOAD_ID_SOURCE, PROPERTIES.getProperty(KEY_XML_TEST_INPUT));
msg.addMetadata("key", "value");
msg.addObjectHeader("myDocumentObject", XmlHelper.createDocument("<data>World</data>"));
MultiPayloadXmlTransformService service = createBaseExample();
service.setUrl(PROPERTIES.getProperty(KEY_XML_NODE_TRANSFORM_URL));
service.setTransformParameter(new XmlTransformParameterBuilder(new IgnoreMetadataParameter(), new StringMetadataParameter(), new ObjectMetadataParameter(".*")));
execute(service, msg);
assertEquals(PROPERTIES.getProperty(KEY_XML_TEST_OUTPUT) + "World", msg.getContent(PAYLOAD_ID_OUTPUT));
}
use of com.adaptris.core.MultiPayloadAdaptrisMessage in project interlok by adaptris.
the class MultiPayloadXmlTransformServiceTest method testSingleParameter_STXOutput.
@Test
public void testSingleParameter_STXOutput() throws Exception {
MultiPayloadAdaptrisMessage msg = MessageHelper.createMultiPayloadMessage(PAYLOAD_ID_SOURCE, PROPERTIES.getProperty(KEY_XML_TEST_INPUT));
msg.addMetadata("world", "World");
MultiPayloadXmlTransformService service = createBaseExample();
service.setUrl(PROPERTIES.getProperty(KEY_XML_TEST_STX_TRANSFORM_URL));
service.setXmlTransformerFactory(new StxTransformerFactory());
service.setTransformParameter(new StringMetadataParameter());
execute(service, msg);
assertEquals(PROPERTIES.getProperty(KEY_XML_TEST_OUTPUT) + "World", msg.getContent(PAYLOAD_ID_OUTPUT));
}
Aggregations