Search in sources :

Example 61 with DefaultMessageFactory

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

the class XmlTransformServiceTest method testObtainUrlWithUrlOnly.

@Test
public void testObtainUrlWithUrlOnly() throws Exception {
    XmlTransformService service = new XmlTransformService();
    AdaptrisMessage msg = new DefaultMessageFactory().newMessage();
    try {
        service.setUrl("url");
        LifecycleHelper.init(service);
        assertTrue(service.obtainUrlToUse(msg).equals("url"));
    } finally {
        LifecycleHelper.close(service);
    }
}
Also used : DefaultMessageFactory(com.adaptris.core.DefaultMessageFactory) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Test(org.junit.Test)

Example 62 with DefaultMessageFactory

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

the class MessageHelperTest method testApplyCharset_Null.

@Test
public void testApplyCharset_Null() {
    AdaptrisMessage msg = new DefaultMessageFactory().newMessage();
    MessageHelper.checkCharsetAndApply(msg, null, true);
}
Also used : DefaultMessageFactory(com.adaptris.core.DefaultMessageFactory) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Test(org.junit.Test)

Example 63 with DefaultMessageFactory

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

the class MessageHelperTest method testApplyCharset_Passthru_Valid.

@Test
public void testApplyCharset_Passthru_Valid() {
    AdaptrisMessage msg = new DefaultMessageFactory().newMessage();
    MessageHelper.checkCharsetAndApply(msg, "ISO-8859-2", true);
    assertEquals("ISO-8859-2", msg.getContentEncoding());
}
Also used : DefaultMessageFactory(com.adaptris.core.DefaultMessageFactory) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Test(org.junit.Test)

Example 64 with DefaultMessageFactory

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

the class MessageHelperTest method testApplyCharset_Passthru_Invalid.

@Test(expected = UnsupportedCharsetException.class)
public void testApplyCharset_Passthru_Invalid() {
    AdaptrisMessage msg = new DefaultMessageFactory().newMessage();
    MessageHelper.checkCharsetAndApply(msg, "UTF-9", true);
}
Also used : DefaultMessageFactory(com.adaptris.core.DefaultMessageFactory) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Test(org.junit.Test)

Example 65 with DefaultMessageFactory

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

the class MessageHelperTest method testApplyCharset_PassthruDisabled_Invalid.

@Test
public void testApplyCharset_PassthruDisabled_Invalid() {
    AdaptrisMessage msg = new DefaultMessageFactory().newMessage();
    MessageHelper.checkCharsetAndApply(msg, "UTF-9", false);
    assertEquals(UnsupportedCharsetException.class, msg.getObjectHeaders().get(CoreConstants.OBJ_METADATA_EXCEPTION).getClass());
}
Also used : DefaultMessageFactory(com.adaptris.core.DefaultMessageFactory) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Test(org.junit.Test)

Aggregations

DefaultMessageFactory (com.adaptris.core.DefaultMessageFactory)170 Test (org.junit.Test)163 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)158 Channel (com.adaptris.core.Channel)37 MockMessageProducer (com.adaptris.core.stubs.MockMessageProducer)36 HttpConsumerTest (com.adaptris.core.http.jetty.HttpConsumerTest)30 JettyHelper.createChannel (com.adaptris.core.http.jetty.JettyHelper.createChannel)30 StandaloneProducer (com.adaptris.core.StandaloneProducer)27 ServiceException (com.adaptris.core.ServiceException)26 File (java.io.File)26 ServiceList (com.adaptris.core.ServiceList)18 HttpConnection (com.adaptris.core.http.jetty.HttpConnection)18 JettyMessageConsumer (com.adaptris.core.http.jetty.JettyMessageConsumer)18 StandardResponseProducer (com.adaptris.core.http.jetty.StandardResponseProducer)18 GuidGenerator (com.adaptris.util.GuidGenerator)18 StandaloneRequestor (com.adaptris.core.StandaloneRequestor)15 ValidationStage (com.adaptris.transform.validate.ValidationStage)15 ConfiguredRequestMethodProvider (com.adaptris.core.http.client.ConfiguredRequestMethodProvider)12 PayloadFromTemplateService (com.adaptris.core.services.metadata.PayloadFromTemplateService)11 StandardWorkflow (com.adaptris.core.StandardWorkflow)10