Search in sources :

Example 1 with StxTransformerFactory

use of com.adaptris.util.text.xml.StxTransformerFactory in project interlok by adaptris.

the class MultiPayloadXmlTransformServiceTest method testMultipleParameters_STXOutput.

@Test
public void testMultipleParameters_STXOutput() 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.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));
}
Also used : StxTransformerFactory(com.adaptris.util.text.xml.StxTransformerFactory) MultiPayloadAdaptrisMessage(com.adaptris.core.MultiPayloadAdaptrisMessage) Test(org.junit.Test)

Example 2 with StxTransformerFactory

use of com.adaptris.util.text.xml.StxTransformerFactory 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));
}
Also used : StxTransformerFactory(com.adaptris.util.text.xml.StxTransformerFactory) MultiPayloadAdaptrisMessage(com.adaptris.core.MultiPayloadAdaptrisMessage) Test(org.junit.Test)

Example 3 with StxTransformerFactory

use of com.adaptris.util.text.xml.StxTransformerFactory in project interlok by adaptris.

the class XmlTransformServiceTest method testSTXOutput.

@Test
public void testSTXOutput() throws Exception {
    AdaptrisMessage m1 = MessageHelper.createMessage(PROPERTIES.getProperty(KEY_XML_TEST_INPUT));
    XmlTransformService service = new XmlTransformService();
    service.setUrl(PROPERTIES.getProperty(KEY_XML_TEST_STX_TRANSFORM_URL));
    service.setXmlTransformerFactory(new StxTransformerFactory());
    execute(service, m1);
    assertEquals("payload " + m1.getContent(), PROPERTIES.getProperty(KEY_XML_TEST_OUTPUT), m1.getContent());
}
Also used : AdaptrisMessage(com.adaptris.core.AdaptrisMessage) StxTransformerFactory(com.adaptris.util.text.xml.StxTransformerFactory) Test(org.junit.Test)

Example 4 with StxTransformerFactory

use of com.adaptris.util.text.xml.StxTransformerFactory in project interlok by adaptris.

the class XmlTransformServiceTest method testSingleParameter_STXOutput.

@Test
public void testSingleParameter_STXOutput() throws Exception {
    AdaptrisMessage msg = MessageHelper.createMessage(PROPERTIES.getProperty(KEY_XML_TEST_INPUT));
    msg.addMetadata("world", "World");
    XmlTransformService service = new XmlTransformService();
    service.setUrl(PROPERTIES.getProperty(KEY_XML_TEST_STX_TRANSFORM_URL));
    service.setXmlTransformerFactory(new StxTransformerFactory());
    service.setTransformParameter(new StringMetadataParameter());
    execute(service, msg);
    assertTrue("payload " + msg.getContent(), msg.getContent().equals(PROPERTIES.getProperty(KEY_XML_TEST_OUTPUT) + "World"));
}
Also used : AdaptrisMessage(com.adaptris.core.AdaptrisMessage) StxTransformerFactory(com.adaptris.util.text.xml.StxTransformerFactory) Test(org.junit.Test)

Example 5 with StxTransformerFactory

use of com.adaptris.util.text.xml.StxTransformerFactory in project interlok by adaptris.

the class XmlTransformServiceTest method testMultipleParameters_STXOutput.

@Test
public void testMultipleParameters_STXOutput() throws Exception {
    AdaptrisMessage msg = MessageHelper.createMessage(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");
    XmlTransformService service = new XmlTransformService();
    service.setUrl(PROPERTIES.getProperty(KEY_XML_TEST_STX_TRANSFORM_URL));
    service.setXmlTransformerFactory(new StxTransformerFactory());
    service.setTransformParameter(new StringMetadataParameter());
    execute(service, msg);
    assertTrue("payload " + msg.getContent(), msg.getContent().equals(PROPERTIES.getProperty(KEY_XML_TEST_OUTPUT) + "World"));
}
Also used : AdaptrisMessage(com.adaptris.core.AdaptrisMessage) StxTransformerFactory(com.adaptris.util.text.xml.StxTransformerFactory) Test(org.junit.Test)

Aggregations

StxTransformerFactory (com.adaptris.util.text.xml.StxTransformerFactory)6 Test (org.junit.Test)6 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)3 MultiPayloadAdaptrisMessage (com.adaptris.core.MultiPayloadAdaptrisMessage)3