use of com.adaptris.core.MultiPayloadAdaptrisMessage in project interlok by adaptris.
the class MultiPayloadXmlTransformServiceTest method testObtainUrlWithNullMetadataValueInMessage.
@Test
public void testObtainUrlWithNullMetadataValueInMessage() throws Exception {
MultiPayloadXmlTransformService service = new MultiPayloadXmlTransformService();
MultiPayloadAdaptrisMessage msg = (MultiPayloadAdaptrisMessage) new MultiPayloadMessageFactory().newMessage();
try {
service.setUrl(URL);
service.setMetadataKey("key");
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 testObtainUrlWithMetadataValueInMessage.
@Test
public void testObtainUrlWithMetadataValueInMessage() throws Exception {
MultiPayloadAdaptrisMessage msg = (MultiPayloadAdaptrisMessage) new MultiPayloadMessageFactory().newMessage();
msg.addMetadata("key", "val");
MultiPayloadXmlTransformService service = new MultiPayloadXmlTransformService();
try {
service.setUrl(URL);
service.setMetadataKey("key");
LifecycleHelper.init(service);
// allow override is false
assertEquals(URL, service.obtainUrlToUse(msg));
} finally {
LifecycleHelper.close(service);
}
}
use of com.adaptris.core.MultiPayloadAdaptrisMessage in project interlok by adaptris.
the class MultiPayloadXmlTransformServiceTest method testXSLT_RecoverableError.
@Test
public void testXSLT_RecoverableError() throws Exception {
MultiPayloadAdaptrisMessage m1 = MessageHelper.createMultiPayloadMessage(PAYLOAD_ID_SOURCE, PROPERTIES.getProperty(KEY_XML_TEST_INPUT));
String oldName = Thread.currentThread().getName();
Thread.currentThread().setName(getName());
MultiPayloadXmlTransformService service = createBaseExample();
try {
execute(service, m1);
// INTERLOK-1850 - Saxon 9.7 won't report exceptions, so even if we throw, it'll just eat it.
// fail("Exception expected but none thrown");
} catch (ServiceException e) {
assertTrue(e.getCause() instanceof TransformerException);
} finally {
Thread.currentThread().setName(oldName);
}
}
use of com.adaptris.core.MultiPayloadAdaptrisMessage in project interlok by adaptris.
the class MultiPayloadXmlTransformServiceTest method testParameterBuilder_XSLTOutput.
@Test
public void testParameterBuilder_XSLTOutput() 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_TRANSFORM_URL));
service.setTransformParameter(new XmlTransformParameterBuilder(new IgnoreMetadataParameter(), 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 testMultipleParameters_XSLTOutput.
@Test
public void testMultipleParameters_XSLTOutput() throws Exception {
MultiPayloadAdaptrisMessage msg = MessageHelper.createMultiPayloadMessage(PAYLOAD_ID_SOURCE, PROPERTIES.getProperty(KEY_XML_TEST_INPUT));
msg.addMetadata("world", "World");
msg.addMetadata("one", "World");
msg.addMetadata("two", "World");
msg.addMetadata("three", "World");
msg.addMetadata("four", "World");
MultiPayloadXmlTransformService service = createBaseExample();
service.setTransformParameter(new StringMetadataParameter());
execute(service, msg);
assertEquals(PROPERTIES.getProperty(KEY_XML_TEST_OUTPUT) + "World", msg.getContent(PAYLOAD_ID_OUTPUT));
}
Aggregations