Search in sources :

Example 6 with DefaultSerializableMessage

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();
    }
}
Also used : MessageTarget(com.adaptris.interlok.client.MessageTarget) DefaultSerializableMessage(com.adaptris.interlok.types.DefaultSerializableMessage) Test(org.junit.Test)

Example 7 with DefaultSerializableMessage

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;
}
Also used : DefaultSerializableMessage(com.adaptris.interlok.types.DefaultSerializableMessage)

Example 8 with DefaultSerializableMessage

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());
}
Also used : DefaultSerializableMessage(com.adaptris.interlok.types.DefaultSerializableMessage) Test(org.junit.Test)

Aggregations

DefaultSerializableMessage (com.adaptris.interlok.types.DefaultSerializableMessage)8 Test (org.junit.Test)7 MessageTarget (com.adaptris.interlok.client.MessageTarget)5 InterlokException (com.adaptris.interlok.InterlokException)2 SerializableMessage (com.adaptris.interlok.types.SerializableMessage)1