@Test public void testAsyncDownloadFailure() throws Exception { Future<Path> future = failureFileSystem.asyncDownloadFile(Paths.get(""), null, 2); try { future.get(); } catch (Exception e) { Assert.assertEquals(1, (int) backupMetrics.getInvalidDownloads().count()); } }
@Override public Future<Path> asyncDownloadFile( final Path remotePath, final Path localPath, final int retry) throws BackupRestoreException, RejectedExecutionException { return fileDownloadExecutor.submit( () -> { downloadFile(remotePath, localPath, retry); return remotePath; }); }
AbstractFileSystem implements IBackupFileSystem, EventGenerator<BackupEvent> { @Override public Future<Path> asyncDownloadFile( final Path remotePath, final Path localPath, final int retry) throws BackupRestoreException, RejectedExecutionException { return fileDownloadExecutor.submit( () -> { downloadFile(remotePath, localPath, retry); return remotePath; }); } }
AbstractFileSystem implements IBackupFileSystem, EventGenerator<BackupEvent> { @Override public Future<Path> asyncDownloadFile( final Path remotePath, final Path localPath, final int retry) throws BackupRestoreException, RejectedExecutionException { return fileDownloadExecutor.submit( () -> { downloadFile(remotePath, localPath, retry); return remotePath; }); } @Inject  AbstractFileSystem(
            IConfiguration configuration,
            BackupMetrics backupMetrics,
            BackupNotificationMgr backupNotificationMgr,
            Provider<AbstractBackupPath> pathProvider); }
AbstractFileSystem implements IBackupFileSystem, EventGenerator<BackupEvent> { @Override public Future<Path> asyncDownloadFile( final Path remotePath, final Path localPath, final int retry) throws BackupRestoreException, RejectedExecutionException { return fileDownloadExecutor.submit( () -> { downloadFile(remotePath, localPath, retry); return remotePath; }); } @Inject  AbstractFileSystem(
            IConfiguration configuration,
            BackupMetrics backupMetrics,
            BackupNotificationMgr backupNotificationMgr,
            Provider<AbstractBackupPath> pathProvider); @Override Future<Path> asyncDownloadFile(
            final Path remotePath, final Path localPath, final int retry); @Override void downloadFile(final Path remotePath, final Path localPath, final int retry); @Override Future<Path> asyncUploadFile(
            final Path localPath,
            final Path remotePath,
            final AbstractBackupPath path,
            final int retry,
            final boolean deleteAfterSuccessfulUpload); @Override void uploadFile(
            final Path localPath,
            final Path remotePath,
            final AbstractBackupPath path,
            final int retry,
            final boolean deleteAfterSuccessfulUpload); @Override boolean checkObjectExists(Path remotePath); @Override void deleteRemoteFiles(List<Path> remotePaths); @Override String getShard(); @Override Path getPrefix(); @Override Iterator<AbstractBackupPath> listPrefixes(Date date); @Override Iterator<AbstractBackupPath> list(String path, Date start, Date till); @Override final void addObserver(EventObserver<BackupEvent> observer); @Override void removeObserver(EventObserver<BackupEvent> observer); @Override void notifyEventStart(BackupEvent event); @Override void notifyEventSuccess(BackupEvent event); @Override void notifyEventFailure(BackupEvent event); @Override void notifyEventStop(BackupEvent event); @Override int getUploadTasksQueued(); @Override int getDownloadTasksQueued(); @Override void clearCache(); }
AbstractFileSystem implements IBackupFileSystem, EventGenerator<BackupEvent> { @Override public Future<Path> asyncDownloadFile( final Path remotePath, final Path localPath, final int retry) throws BackupRestoreException, RejectedExecutionException { return fileDownloadExecutor.submit( () -> { downloadFile(remotePath, localPath, retry); return remotePath; }); } @Inject  AbstractFileSystem(
            IConfiguration configuration,
            BackupMetrics backupMetrics,
            BackupNotificationMgr backupNotificationMgr,
            Provider<AbstractBackupPath> pathProvider); @Override Future<Path> asyncDownloadFile(
            final Path remotePath, final Path localPath, final int retry); @Override void downloadFile(final Path remotePath, final Path localPath, final int retry); @Override Future<Path> asyncUploadFile(
            final Path localPath,
            final Path remotePath,
            final AbstractBackupPath path,
            final int retry,
            final boolean deleteAfterSuccessfulUpload); @Override void uploadFile(
            final Path localPath,
            final Path remotePath,
            final AbstractBackupPath path,
            final int retry,
            final boolean deleteAfterSuccessfulUpload); @Override boolean checkObjectExists(Path remotePath); @Override void deleteRemoteFiles(List<Path> remotePaths); @Override String getShard(); @Override Path getPrefix(); @Override Iterator<AbstractBackupPath> listPrefixes(Date date); @Override Iterator<AbstractBackupPath> list(String path, Date start, Date till); @Override final void addObserver(EventObserver<BackupEvent> observer); @Override void removeObserver(EventObserver<BackupEvent> observer); @Override void notifyEventStart(BackupEvent event); @Override void notifyEventSuccess(BackupEvent event); @Override void notifyEventFailure(BackupEvent event); @Override void notifyEventStop(BackupEvent event); @Override int getUploadTasksQueued(); @Override int getDownloadTasksQueued(); @Override void clearCache();  }