Search in sources :

Example 1 with MultiPayloadMessageFactory

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

Example 2 with MultiPayloadMessageFactory

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

Example 3 with MultiPayloadMessageFactory

use of com.adaptris.core.MultiPayloadMessageFactory in project interlok by adaptris.

the class MultiPayloadXmlTransformServiceTest method testObtainUrlWithEmptyMetadataValue.

@Test
public void testObtainUrlWithEmptyMetadataValue() throws Exception {
    MultiPayloadAdaptrisMessage msg = (MultiPayloadAdaptrisMessage) new MultiPayloadMessageFactory().newMessage();
    msg.addMetadata("key", "");
    MultiPayloadXmlTransformService service = new MultiPayloadXmlTransformService();
    try {
        service.setUrl(URL);
        service.setMetadataKey("key");
        service.setAllowOverride(true);
        LifecycleHelper.init(service);
        assertEquals(URL, service.obtainUrlToUse(msg));
    } finally {
        LifecycleHelper.close(service);
    }
}
Also used : MultiPayloadMessageFactory(com.adaptris.core.MultiPayloadMessageFactory) MultiPayloadAdaptrisMessage(com.adaptris.core.MultiPayloadAdaptrisMessage) Test(org.junit.Test)

Example 4 with MultiPayloadMessageFactory

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

Example 5 with MultiPayloadMessageFactory

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

Aggregations

MultiPayloadMessageFactory (com.adaptris.core.MultiPayloadMessageFactory)26 MultiPayloadAdaptrisMessage (com.adaptris.core.MultiPayloadAdaptrisMessage)24 Test (org.junit.Test)23 InputStream (java.io.InputStream)5 ByteArrayInputStream (java.io.ByteArrayInputStream)4 Before (org.junit.Before)2 ServiceException (com.adaptris.core.ServiceException)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1