use of com.adaptris.core.QuartzCronPoller in project interlok by adaptris.
the class RelaxedFtpCase method testConsume_OverrideUrl.
@Test
public void testConsume_OverrideUrl() throws Exception {
if (areTestsEnabled()) {
MockMessageListener listener = new MockMessageListener();
RelaxedFtpConsumer ftpConsumer = new RelaxedFtpConsumer();
ftpConsumer.setFtpEndpoint(getDestinationStringWithOverride());
ftpConsumer.setQuietInterval(DEFAULT_QUIET_PERIOD);
ftpConsumer.registerAdaptrisMessageListener(listener);
// Pass in a QuartzId so we don't print out the uname+password.
ftpConsumer.setPoller(new QuartzCronPoller("*/1 * * * * ?", "testBasicConsumeWithOverride"));
FileTransferConnectionUsingPassword con = createConnection();
con.setDefaultPassword(null);
con.setDefaultUserName(null);
StandaloneConsumer sc = new StandaloneConsumer(con, ftpConsumer);
start(sc);
int count = 1;
try {
produce(new StandaloneProducer(createConnection(), createFtpProducer()), count);
waitForMessages(listener, count);
assertMessages(listener.getMessages(), count);
} finally {
stop(sc);
}
}
}
use of com.adaptris.core.QuartzCronPoller in project interlok by adaptris.
the class FtpConsumerCase method testInit_UnknownFileFilter.
@Test
public void testInit_UnknownFileFilter() throws Exception {
FtpConsumer ftpConsumer = new FtpConsumer();
ftpConsumer.setFtpEndpoint(getDestinationString());
ftpConsumer.setFileFilterImp(".*");
ftpConsumer.setFileFilterImp("BlahDeBlahDeBlah");
ftpConsumer.setPoller(new QuartzCronPoller("*/1 * * * * ?"));
try {
ftpConsumer.init();
ftpConsumer.close();
fail();
} catch (CoreException expected) {
}
}
use of com.adaptris.core.QuartzCronPoller in project interlok by adaptris.
the class FtpConsumerCase method testInit_ProcDir.
@Test
public void testInit_ProcDir() throws Exception {
FtpConsumer ftpConsumer = new FtpConsumer();
ftpConsumer.setFtpEndpoint(getDestinationString());
ftpConsumer.setWorkDirectory("/work");
ftpConsumer.setPoller(new QuartzCronPoller("*/1 * * * * ?"));
ftpConsumer.init();
ftpConsumer.close();
ftpConsumer.setProcDirectory("/proc");
ftpConsumer.init();
ftpConsumer.close();
ftpConsumer.setProcDirectory("proc");
ftpConsumer.init();
ftpConsumer.close();
}
use of com.adaptris.core.QuartzCronPoller in project interlok by adaptris.
the class FtpConsumerCase method testInit_WorkDir.
@Test
public void testInit_WorkDir() throws Exception {
FtpConsumer ftpConsumer = new FtpConsumer();
ftpConsumer.setFtpEndpoint(getDestinationString());
ftpConsumer.setFileFilterImp(null);
ftpConsumer.setWorkDirectory(null);
ftpConsumer.setPoller(new QuartzCronPoller("*/1 * * * * ?"));
try {
ftpConsumer.init();
ftpConsumer.close();
fail();
} catch (CoreException expected) {
}
ftpConsumer.setWorkDirectory("work");
ftpConsumer.init();
ftpConsumer.close();
ftpConsumer.setWorkDirectory("/work");
ftpConsumer.init();
ftpConsumer.close();
}
use of com.adaptris.core.QuartzCronPoller in project interlok by adaptris.
the class FtpCase method testBasicConsume.
@Test
public void testBasicConsume() throws Exception {
Assume.assumeTrue(areTestsEnabled());
MockMessageListener listener = new MockMessageListener();
FtpConsumer ftpConsumer = new FtpConsumer();
ftpConsumer.setFtpEndpoint(getDestinationString());
ftpConsumer.setWorkDirectory(DEFAULT_WORK_DIR);
ftpConsumer.registerAdaptrisMessageListener(listener);
ftpConsumer.setPoller(new QuartzCronPoller("*/1 * * * * ?"));
StandaloneConsumer sc = new StandaloneConsumer(createConnection(), ftpConsumer);
start(sc);
int count = 1;
try {
produce(new StandaloneProducer(createConnection(), createFtpProducer()), count);
waitForMessages(listener, count);
assertMessages(listener.getMessages(), count);
} finally {
stop(sc);
}
}
Aggregations