use of com.adaptris.core.fs.FsConsumer in project interlok by adaptris.
the class JmsTransactedWorkflowTest method testInit_UnsupportedConsumer.
@Test
public void testInit_UnsupportedConsumer() throws Exception {
Channel channel = createStartableChannel(activeMqBroker);
JmsTransactedWorkflow workflow = (JmsTransactedWorkflow) channel.getWorkflowList().get(0);
workflow.setConsumer(new FsConsumer().withBaseDirectoryUrl("file:////path/to/directory"));
try {
channel.requestInit();
} catch (CoreException expected) {
assertEquals("JmsTransactedWorkflow must be used with a JMSConsumer", expected.getMessage());
} finally {
channel.requestClose();
}
}
use of com.adaptris.core.fs.FsConsumer in project interlok by adaptris.
the class DefaultFailedMessageRetrierTest method createForExamples.
@Override
protected DefaultFailedMessageRetrier createForExamples() {
DefaultFailedMessageRetrier fmr = new DefaultFailedMessageRetrier();
FsConsumer consumer = new FsConsumer();
consumer.setBaseDirectoryUrl("/path/to/retry-directory");
consumer.setEncoder(new MimeEncoder(true, null, null));
fmr.setStandaloneConsumer(new StandaloneConsumer(consumer));
return fmr;
}
use of com.adaptris.core.fs.FsConsumer in project interlok by adaptris.
the class SharedComponentListTest method createAdapter.
private Adapter createAdapter() throws CoreException, PasswordException {
Adapter adapter = new Adapter();
adapter.setUniqueId("upbeat_liskov");
JmsConnection jmsConnection = createPtpConnection("jms-connection");
adapter.getSharedComponents().addConnection(jmsConnection);
ServiceList serviceList = new ServiceList();
serviceList.setUniqueId("shared-service-list");
serviceList.add(new LogMessageService("log-message-service"));
adapter.getSharedComponents().addService(serviceList);
StandardWorkflow wf1 = new StandardWorkflow();
wf1.setUniqueId("reverent-edison");
wf1.setConsumer(new FsConsumer().withBaseDirectoryUrl("in-directory"));
wf1.setProducer(new FsProducer().withBaseDirectoryUrl("out-directory"));
wf1.getServiceCollection().add(new SharedService("shared-service-list"));
StandardWorkflow wf = new StandardWorkflow();
wf.setUniqueId("pedantic_brown");
wf.setConsumer(new JmsConsumer().withEndpoint("jms:queue:SampleQueue1"));
wf.setProducer(new NullMessageProducer());
wf.getServiceCollection().add(new StandaloneProducer(new SharedConnection("jms-connection"), new JmsProducer().withEndpoint("jms:topic:MyTopicName")));
Channel channel = new Channel();
channel.setUniqueId("quirky_shannon");
channel.setConsumeConnection(new SharedConnection("jms-connection"));
channel.getWorkflowList().add(wf);
channel.getWorkflowList().add(wf1);
adapter.getChannelList().add(channel);
return adapter;
}
use of com.adaptris.core.fs.FsConsumer in project interlok by adaptris.
the class DefaultFailedMessageRetrierTest method retrieveObjectForSampleConfig.
@Override
protected Object retrieveObjectForSampleConfig() {
Adapter result = null;
try {
DefaultFailedMessageRetrier fmr = new DefaultFailedMessageRetrier();
FsConsumer consumer = new FsConsumer().withBaseDirectoryUrl("/path/to/retry-directory");
StandaloneConsumer c = new StandaloneConsumer(consumer);
fmr.setStandaloneConsumer(c);
result = new Adapter();
result.setFailedMessageRetrier(fmr);
result.setChannelList(new ChannelList());
result.setEventHandler(new StubEventHandler());
result.setUniqueId(UUID.randomUUID().toString());
} catch (Exception e) {
throw new RuntimeException(e);
}
return result;
}
use of com.adaptris.core.fs.FsConsumer in project interlok by adaptris.
the class LargeFsConsumerTest method testConsumeWithAlternateFactory.
@Test
public void testConsumeWithAlternateFactory() throws Exception {
String subDir = GUID.safeUUID();
MockMessageListener stub = new MockMessageListener(10);
FsConsumer fs = createConsumer(subDir);
fs.setResetWipFiles(false);
fs.setMessageFactory(new DefaultMessageFactory());
fs.setPoller(new FixedIntervalPoller(new TimeInterval(300L, TimeUnit.MILLISECONDS)));
StandaloneConsumer sc = new StandaloneConsumer(fs);
sc.registerAdaptrisMessageListener(stub);
int count = 10;
File parentDir = FsHelper.createFileReference(FsHelper.createUrlFromString(PROPERTIES.getProperty(BASE_KEY), true));
try {
File baseDir = new File(parentDir, subDir);
baseDir.mkdirs();
super.createFiles(baseDir, ".xml", count);
start(sc);
waitForMessages(stub, count);
assertEquals(count, stub.getMessages().size());
super.assertMessages(stub.getMessages(), count, baseDir.listFiles((FilenameFilter) new Perl5FilenameFilter(".*\\.xml")));
assertDefaultMessageType(stub.getMessages());
} finally {
stop(sc);
FileUtils.deleteQuietly(new File(parentDir, subDir));
}
}
Aggregations