Search in sources :

Example 11 with FileBackedMessageFactory

use of com.adaptris.core.lms.FileBackedMessageFactory in project interlok by adaptris.

the class MessageHelperTest method testCopyPayload_BothFileBacked.

@Test
public void testCopyPayload_BothFileBacked() throws Exception {
    AdaptrisMessage reply = new FileBackedMessageFactory().newMessage("hello world");
    AdaptrisMessage original = new FileBackedMessageFactory().newMessage();
    MessageHelper.copyPayload(reply, original);
    assertEquals("hello world", original.getContent());
    assertTrue(original.getObjectHeaders().containsKey(reply.getUniqueId()));
}
Also used : FileBackedMessageFactory(com.adaptris.core.lms.FileBackedMessageFactory) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Test(org.junit.Test)

Example 12 with FileBackedMessageFactory

use of com.adaptris.core.lms.FileBackedMessageFactory in project interlok by adaptris.

the class MessageHelperTest method testCopyPayload_OneFileBacked.

@Test
public void testCopyPayload_OneFileBacked() throws Exception {
    AdaptrisMessage reply = new FileBackedMessageFactory().newMessage("hello world");
    AdaptrisMessage original = new DefaultMessageFactory().newMessage();
    MessageHelper.copyPayload(reply, original);
    assertEquals("hello world", original.getContent());
    assertFalse(original.getObjectHeaders().containsKey(reply.getUniqueId()));
}
Also used : DefaultMessageFactory(com.adaptris.core.DefaultMessageFactory) FileBackedMessageFactory(com.adaptris.core.lms.FileBackedMessageFactory) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Test(org.junit.Test)

Example 13 with FileBackedMessageFactory

use of com.adaptris.core.lms.FileBackedMessageFactory in project interlok by adaptris.

the class SerializableMessageTranslatorTest method testSerialize_FileBackedMessage_Small.

@Test
public void testSerialize_FileBackedMessage_Small() throws Exception {
    FileBackedMessage adaptrisMessage = (FileBackedMessage) new FileBackedMessageFactory().newMessage("Some Payload");
    adaptrisMessage.addMetadata("MetaKey1", "MetaValue1");
    adaptrisMessage.addMetadata("MetaKey2", "MetaValue2");
    SerializableMessage serialisableAdaptrisMessage = new DefaultSerializableMessageTranslator().translate(adaptrisMessage);
    assertEquals("MetaValue1", serialisableAdaptrisMessage.getMessageHeaders().get("MetaKey1"));
    assertEquals("MetaValue2", serialisableAdaptrisMessage.getMessageHeaders().get("MetaKey2"));
    assertEquals(adaptrisMessage.getUniqueId(), serialisableAdaptrisMessage.getUniqueId());
    assertEquals("Some Payload", serialisableAdaptrisMessage.getContent());
}
Also used : FileBackedMessageFactory(com.adaptris.core.lms.FileBackedMessageFactory) SerializableMessage(com.adaptris.interlok.types.SerializableMessage) FileBackedMessage(com.adaptris.core.lms.FileBackedMessage) Test(org.junit.Test)

Example 14 with FileBackedMessageFactory

use of com.adaptris.core.lms.FileBackedMessageFactory in project interlok by adaptris.

the class RequestReplyProducerBaseTest method testCopyReplyContents_BothFileBacked.

@Test
public void testCopyReplyContents_BothFileBacked() throws Exception {
    AdaptrisMessage reply = new FileBackedMessageFactory().newMessage("hello world");
    AdaptrisMessage original = new FileBackedMessageFactory().newMessage();
    copyReplyContents(reply, original);
    assertEquals("hello world", original.getContent());
    assertTrue(original.getObjectHeaders().containsKey(reply.getUniqueId()));
}
Also used : FileBackedMessageFactory(com.adaptris.core.lms.FileBackedMessageFactory) Test(org.junit.Test)

Example 15 with FileBackedMessageFactory

use of com.adaptris.core.lms.FileBackedMessageFactory in project interlok by adaptris.

the class RequestReplyProducerBaseTest method testCopyReplyContents_OneFileBacked.

@Test
public void testCopyReplyContents_OneFileBacked() throws Exception {
    AdaptrisMessage reply = new FileBackedMessageFactory().newMessage("hello world");
    AdaptrisMessage original = new DefaultMessageFactory().newMessage();
    copyReplyContents(reply, original);
    assertEquals("hello world", original.getContent());
    assertFalse(original.getObjectHeaders().containsKey(reply.getUniqueId()));
}
Also used : FileBackedMessageFactory(com.adaptris.core.lms.FileBackedMessageFactory) Test(org.junit.Test)

Aggregations

FileBackedMessageFactory (com.adaptris.core.lms.FileBackedMessageFactory)16 Test (org.junit.Test)16 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)4 StandaloneConsumer (com.adaptris.core.StandaloneConsumer)4 MockMessageListener (com.adaptris.core.stubs.MockMessageListener)4 DefaultMessageFactory (com.adaptris.core.DefaultMessageFactory)2 StandaloneProducer (com.adaptris.core.StandaloneProducer)2 PtpConsumer (com.adaptris.core.jms.PtpConsumer)2 PtpProducer (com.adaptris.core.jms.PtpProducer)2 FileBackedMessage (com.adaptris.core.lms.FileBackedMessage)2 SerializableMessage (com.adaptris.interlok.types.SerializableMessage)2 File (java.io.File)2 FakeFtpServer (org.mockftpserver.fake.FakeFtpServer)2 FileFilter (java.io.FileFilter)1 RandomAccessFile (java.io.RandomAccessFile)1 DirectoryFileFilter (org.apache.commons.io.filefilter.DirectoryFileFilter)1