use of com.adaptris.interlok.types.DefaultSerializableMessage in project interlok by adaptris.
the class InterlokJmxClientTest method testProcessAsync_SerializableMessage.
@Test
public void testProcessAsync_SerializableMessage() throws Exception {
MyMessageProcessor proc = new MyMessageProcessor();
MessageTarget target = new MessageTarget().withAdapter(testName.getMethodName()).withChannel(testName.getMethodName()).withWorkflow(testName.getMethodName());
DefaultSerializableMessage msg = new DefaultSerializableMessage().withPayload(testName.getMethodName());
register(createObjectName(target), proc);
InterlokJmxClient client = new InterlokJmxClient(jmxConnectorServer.getAddress());
try {
client.connect();
client.processAsync(target, msg);
assertEquals(msg.getUniqueId(), proc.getMessage().getUniqueId());
assertEquals(msg.getContent(), proc.getMessage().getContent());
} finally {
client.disconnect();
}
}
use of com.adaptris.interlok.types.DefaultSerializableMessage in project interlok by adaptris.
the class MyMessageProcessor method process.
@Override
public SerializableMessage process(SerializableMessage msg) throws InterlokException {
message = msg;
DefaultSerializableMessage reply = new DefaultSerializableMessage().withMessageHeaders(msg.getMessageHeaders()).withPayload(msg.getContent()).withPayloadEncoding(msg.getContentEncoding());
return reply;
}
use of com.adaptris.interlok.types.DefaultSerializableMessage in project interlok by adaptris.
the class DefaultSerializableMessageTranslatorTest method testBase64Decode.
@Test
public void testBase64Decode() throws Exception {
DefaultSerializableMessage serializableMessage = new DefaultSerializableMessage();
serializableMessage.setContent(BASE64_ENCODED);
serializableMessage.addMessageHeader("_interlokMessageSerialization", "BASE64");
DefaultSerializableMessageTranslator translator = new DefaultSerializableMessageTranslator();
AdaptrisMessage adaptrisMessage = translator.translate(serializableMessage);
assertEquals(BASE64_ORIGINAL, adaptrisMessage.getContent());
}
Aggregations