use of com.adaptris.core.fs.FsConsumer in project interlok by adaptris.
the class LargeFsConsumerTest method testConsume_WithUnsupportedEncoder.
@Test
public void testConsume_WithUnsupportedEncoder() throws Exception {
String subDir = GUID.safeUUID();
MockMessageListener stub = new MockMessageListener(10);
FsConsumer fs = createConsumer(subDir);
fs.setResetWipFiles(false);
fs.setPoller(new FixedIntervalPoller(new TimeInterval(300L, TimeUnit.MILLISECONDS)));
fs.setEncoder(new MimeEncoder());
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();
createMimeFiles(baseDir, ".xml", count);
start(sc);
waitForMessages(stub, count);
assertEquals(count, stub.getMessages().size());
assertIgnoreSize(stub.getMessages(), count, baseDir.listFiles((FilenameFilter) new Perl5FilenameFilter(".*\\.xml")));
} finally {
stop(sc);
// FileUtils.deleteQuietly(new File(parentDir, subDir));
}
}
use of com.adaptris.core.fs.FsConsumer in project interlok by adaptris.
the class LargeFsConsumerTest method testConsume_WithEncoder.
@Test
public void testConsume_WithEncoder() throws Exception {
String subDir = GUID.safeUUID();
MockMessageListener stub = new MockMessageListener(10);
FsConsumer fs = createConsumer(subDir);
fs.setResetWipFiles(false);
fs.setPoller(new FixedIntervalPoller(new TimeInterval(300L, TimeUnit.MILLISECONDS)));
fs.setEncoder(new FileBackedMimeEncoder());
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();
createMimeFiles(baseDir, ".xml", count);
start(sc);
waitForMessages(stub, count);
assertEquals(count, stub.getMessages().size());
assertIgnoreSize(stub.getMessages(), count, baseDir.listFiles((FilenameFilter) new Perl5FilenameFilter(".*\\.xml")));
} finally {
stop(sc);
// FileUtils.deleteQuietly(new File(parentDir, subDir));
}
}
Aggregations