use of com.adaptris.core.DefaultMessageFactory in project interlok by adaptris.
the class ConfiguredContentTypeProviderTest method testGetContentType_ConfiguredCharset.
@Test
public void testGetContentType_ConfiguredCharset() throws Exception {
ConfiguredContentTypeProvider provider = new ConfiguredContentTypeProvider("text/complicated; charset=ISO-8859-1");
AdaptrisMessage msg = new DefaultMessageFactory().newMessage("");
msg.addMetadata(testName.getMethodName(), "text/complicated");
String contentType = provider.getContentType(msg);
assertEquals("text/complicated; charset=ISO-8859-1", contentType);
}
use of com.adaptris.core.DefaultMessageFactory in project interlok by adaptris.
the class ConfiguredContentTypeProviderTest method testGetContentType_ConfiguredWithCrapParams.
@Test
public void testGetContentType_ConfiguredWithCrapParams() throws Exception {
ConfiguredContentTypeProvider provider = new ConfiguredContentTypeProvider("text/complicated; shouldbreak=");
AdaptrisMessage msg = new DefaultMessageFactory().newMessage("");
msg.setContentEncoding("UTF-8");
String contentType = provider.getContentType(msg);
assertEquals("text/complicated; shouldbreak=; charset=UTF-8", contentType);
}
use of com.adaptris.core.DefaultMessageFactory in project interlok by adaptris.
the class ConfiguredContentTypeProviderTest method testGetContentType_ConfiguredWithCharset.
@Test
public void testGetContentType_ConfiguredWithCharset() throws Exception {
ConfiguredContentTypeProvider provider = new ConfiguredContentTypeProvider("text/complicated; charset=ISO-8859-1");
AdaptrisMessage msg = new DefaultMessageFactory().newMessage("");
msg.setContentEncoding("UTF-8");
String contentType = provider.getContentType(msg);
assertEquals("text/complicated; charset=ISO-8859-1", contentType);
}
use of com.adaptris.core.DefaultMessageFactory in project interlok by adaptris.
the class ConfiguredContentTypeProviderTest method testGetContentType_WithCharset.
@Test
public void testGetContentType_WithCharset() throws Exception {
ConfiguredContentTypeProvider provider = new ConfiguredContentTypeProvider("text/complicated");
AdaptrisMessage msg = new DefaultMessageFactory().newMessage("");
msg.setContentEncoding("UTF-8");
String contentType = provider.getContentType(msg);
assertEquals("text/complicated; charset=UTF-8", contentType);
}
use of com.adaptris.core.DefaultMessageFactory in project interlok by adaptris.
the class BlobMessageTranslatorTest method testBug895.
@Test
public void testBug895() throws Exception {
MessageTypeTranslatorImp trans = new BlobMessageTranslator();
JmsConnection conn = null;
try {
conn = activeMqBroker.getJmsConnection(new BasicActiveMqImplementation());
start(conn);
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
msg.addMetadata(JmsConstants.JMS_PRIORITY, "9");
msg.addMetadata(JmsConstants.JMS_TYPE, "idaho");
Session session = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
trans.setMoveJmsHeaders(true);
trans.registerSession(session);
trans.registerMessageFactory(new DefaultMessageFactory());
start(trans);
Message jmsMsg = trans.translate(msg);
assertNotSame("JMS Priorities should be different", jmsMsg.getJMSPriority(), 9);
assertEquals("JMSType should be equal", "idaho", jmsMsg.getJMSType());
} finally {
stop(trans);
stop(conn);
}
}
Aggregations