use of com.adaptris.core.lms.FileBackedMessageFactory in project interlok by adaptris.
the class FilesystemRetryStoreTest method testWrite_FileBacked.
@Test
public void testWrite_FileBacked() throws Exception {
FilesystemRetryStore store = new FilesystemRetryStore().withBaseUrl(BaseCase.getConfiguration(TEST_BASE_URL));
try {
LifecycleHelper.initAndStart(store);
AdaptrisMessage msg = new FileBackedMessageFactory().newMessage("hello");
store.write(msg);
File dir = FsHelper.toFile(BaseCase.getConfiguration(TEST_BASE_URL));
assertTrue(dir.listFiles((FileFilter) DirectoryFileFilter.DIRECTORY).length >= 1);
} finally {
LifecycleHelper.stopAndClose(store);
}
}
use of com.adaptris.core.lms.FileBackedMessageFactory in project interlok by adaptris.
the class FtpRecursiveConsumerTest method testBasicConsume_WithFileBackedMessage.
@Test
public void testBasicConsume_WithFileBackedMessage() throws Exception {
int count = 1;
EmbeddedFtpServer helper = new EmbeddedFtpServer();
MockMessageListener listener = new MockMessageListener();
FakeFtpServer server = helper.createAndStart(helper.createFilesystem(count));
StandaloneConsumer sc = null;
try {
FtpRecursiveConsumer ftpConsumer = createForTests(listener);
ftpConsumer.setMessageFactory(new FileBackedMessageFactory());
FtpConnection consumeConnection = create(server);
sc = new StandaloneConsumer(consumeConnection, ftpConsumer);
start(sc);
waitForMessages(listener, count);
helper.assertMessages(listener.getMessages(), count);
} catch (Exception e) {
throw e;
} finally {
stop(sc);
server.stop();
}
}
use of com.adaptris.core.lms.FileBackedMessageFactory in project interlok by adaptris.
the class BasicActiveMqConsumerTest method testBlobProduceAndConsumeWithFileMessageFactory.
@Test
public void testBlobProduceAndConsumeWithFileMessageFactory() throws Exception {
if (!ExternalResourcesHelper.isExternalServerAvailable()) {
log.debug("Blob Server not available; skipping test");
return;
}
PtpConsumer consumer = new PtpConsumer().withQueue(getName());
consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
consumer.setMessageTranslator(new BlobMessageTranslator());
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(createVendorImpl()), consumer);
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
PtpProducer producer = new PtpProducer().withQueue((getName()));
producer.setMessageTranslator(new BlobMessageTranslator("blobUrl"));
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl()), producer);
execute(standaloneConsumer, standaloneProducer, addBlobUrlRef(createMessage(new FileBackedMessageFactory()), "blobUrl"), jms);
assertMessages(jms, 1, false);
}
use of com.adaptris.core.lms.FileBackedMessageFactory in project interlok by adaptris.
the class ExampleEventHandlerCase method testSetMessageFactory.
@Test
public void testSetMessageFactory() throws Exception {
T eh = newEventHandler(getName());
assertNull(eh.getMessageFactory());
assertEquals(DefaultMessageFactory.class, eh.currentMessageFactory().getClass());
eh.setMessageFactory(new FileBackedMessageFactory());
assertNotNull(eh.getMessageFactory());
assertEquals(FileBackedMessageFactory.class, eh.getMessageFactory().getClass());
assertEquals(FileBackedMessageFactory.class, eh.currentMessageFactory().getClass());
}
use of com.adaptris.core.lms.FileBackedMessageFactory in project interlok by adaptris.
the class SerializableMessageTranslatorTest method testMessageFactory.
@Test
public void testMessageFactory() throws Exception {
DefaultSerializableMessageTranslator translator = new DefaultSerializableMessageTranslator();
assertEquals(DefaultMessageFactory.class, translator.currentMessageFactory().getClass());
translator.registerMessageFactory(new FileBackedMessageFactory());
assertEquals(FileBackedMessageFactory.class, translator.currentMessageFactory().getClass());
}
Aggregations