use of com.adaptris.interlok.cloud.RemoteBlob in project interlok by adaptris.
the class RemoteBlobIterableImpl method next.
@Override
public RemoteBlob next() {
RemoteBlob ret = nextBlob;
nextBlob = null;
return ret;
}
use of com.adaptris.interlok.cloud.RemoteBlob in project interlok by adaptris.
the class FilesystemRetryStore method report.
@Override
public Iterable<RemoteBlob> report() throws InterlokException {
List<RemoteBlob> result = new ArrayList<>();
try {
File target = validateDir(FsHelper.toFile(getBaseUrl()), false);
File[] files = fsWorker.listFiles(target, DirectoryFileFilter.DIRECTORY);
for (File msgId : files) {
Optional.ofNullable(createForReport(msgId)).ifPresent((blob) -> result.add(blob));
}
} catch (Exception e) {
throw ExceptionHelper.wrapInterlokException(e);
}
return result;
}
use of com.adaptris.interlok.cloud.RemoteBlob in project interlok by adaptris.
the class FilesystemRetryStoreTest method testCreateForReport.
@Test
public void testCreateForReport() throws Exception {
FilesystemRetryStore store = new FilesystemRetryStore().withBaseUrl(BaseCase.getConfiguration(TEST_BASE_URL));
try {
LifecycleHelper.initAndStart(store);
AdaptrisMessage msg = new DefaultMessageFactory().newMessage("hello");
store.write(msg);
File retryStoreDir = FsHelper.toFile(BaseCase.getConfiguration(TEST_BASE_URL));
File storedMsgDir = new File(retryStoreDir, msg.getUniqueId());
RemoteBlob blob = FilesystemRetryStore.createForReport(storedMsgDir);
assertNotNull(blob);
assertEquals("hello".length(), blob.getSize());
File randomDir = TempFileUtils.createTrackedDir(store);
assertNull(FilesystemRetryStore.createForReport(randomDir));
assertNull(FilesystemRetryStore.createForReport(null));
} finally {
LifecycleHelper.stopAndClose(store);
}
}
Aggregations