use of com.adaptris.core.StandaloneConsumer in project interlok by adaptris.
the class FtpConsumerTest method testConsumeWithQuietPeriod.
@Test
public void testConsumeWithQuietPeriod() throws Exception {
int count = 1;
EmbeddedFtpServer helper = new EmbeddedFtpServer();
MockMessageListener listener = new MockMessageListener();
FakeFtpServer server = helper.createAndStart(helper.createFilesystem(count));
StandaloneConsumer sc = null;
try {
FtpConsumer ftpConsumer = createForTests(listener);
ftpConsumer.setQuietInterval(new TimeInterval(1L, TimeUnit.SECONDS));
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.StandaloneConsumer in project interlok by adaptris.
the class FtpConsumerCase method createConsumerExample.
private StandaloneConsumer createConsumerExample(Poller pollingImp) {
FtpConsumer consumer = new FtpConsumer();
FileTransferConnection con = createConnectionForExamples();
consumer.setProcDirectory("/proc");
consumer.setFtpEndpoint(getScheme() + "://overrideuser:overridepassword@hostname:port/path/to/directory");
consumer.setFileFilterImp("*.xml");
consumer.setPoller(pollingImp);
StandaloneConsumer result = new StandaloneConsumer();
result.setConnection(con);
result.setConsumer(consumer);
return result;
}
use of com.adaptris.core.StandaloneConsumer in project interlok by adaptris.
the class FtpConsumerTest method testConsume_ForceRelativePath.
@Test
public void testConsume_ForceRelativePath() throws Exception {
int count = 1;
EmbeddedFtpServer helper = new EmbeddedFtpServer();
MockMessageListener listener = new MockMessageListener(100);
FakeFtpServer server = helper.createAndStart(helper.createFilesystem(count));
StandaloneConsumer sc = null;
try {
FtpConsumer ftpConsumer = createForTests(listener);
ftpConsumer.setWorkDirectory(SLASH + DEFAULT_WORK_DIR_NAME);
FtpConnection consumeConnection = create(server);
consumeConnection.setForceRelativePath(Boolean.TRUE);
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.StandaloneConsumer in project interlok by adaptris.
the class FtpConsumerTest method testActiveModeConsume.
@Test
public void testActiveModeConsume() throws Exception {
int count = 1;
EmbeddedFtpServer helper = new EmbeddedFtpServer();
MockMessageListener listener = new MockMessageListener(100);
FakeFtpServer server = helper.createAndStart(helper.createFilesystem(count));
StandaloneConsumer sc = null;
try {
FtpConsumer ftpConsumer = createForTests(listener);
FtpConnection consumeConnection = create(server);
consumeConnection.setFtpDataMode(FtpDataMode.ACTIVE);
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.StandaloneConsumer in project interlok by adaptris.
the class FtpConsumerTest method testConsumeWithOverride.
@Test
public void testConsumeWithOverride() throws Exception {
int count = 1;
EmbeddedFtpServer helper = new EmbeddedFtpServer();
MockMessageListener listener = new MockMessageListener();
FakeFtpServer server = helper.createAndStart(helper.createFilesystem(count));
StandaloneConsumer sc = null;
try {
FtpConsumer ftpConsumer = createForTests(listener, DESTINATION_URL_OVERRIDE);
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();
}
}
Aggregations