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);
}
}
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);
}
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());
}
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);
}
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());
}
Aggregations