@RunWithCustomExecutor @Test public void should_throw_VitamRuntimeException_when_listing_and_storage_throws_StorageServerClientException() throws StorageServerClientException { Mockito .when(storageClientFactory.getClient().getOfferLogs(VitamConfiguration.getDefaultStrategy(), DataCategory.BACKUP_OPERATION, 100L, 2, Order.ASC)) .thenThrow(new StorageServerClientException("storage error")); RestoreBackupService restoreBackupService = new RestoreBackupService(storageClientFactory); Iterator<List<OfferLog>> listing = restoreBackupService.getListing(VitamConfiguration.getDefaultStrategy(), 100L, 2); assertThatCode(() -> IteratorUtils.toList(listing)) .isInstanceOf(VitamRuntimeException.class); }
public Iterator<List<OfferLog>> getListing(String strategy, long offset, int limit) { LOGGER.info(String.format( "[Reconstruction]: Retrieve listing of {%s} Collection on {%s} Vitam strategy from {%s} offset with {%s} limit", DataCategory.BACKUP_OPERATION.name(), strategy, offset, limit)); return Iterators.partition( OfferLogHelper.getListing(storageClientFactory, strategy, DataCategory.BACKUP_OPERATION, offset, Order.ASC, VitamConfiguration.getRestoreBulkSize(), limit), VitamConfiguration.getRestoreBulkSize()); }
RestoreBackupService { public Iterator<List<OfferLog>> getListing(String strategy, long offset, int limit) { LOGGER.info(String.format( "[Reconstruction]: Retrieve listing of {%s} Collection on {%s} Vitam strategy from {%s} offset with {%s} limit", DataCategory.BACKUP_OPERATION.name(), strategy, offset, limit)); return Iterators.partition( OfferLogHelper.getListing(storageClientFactory, strategy, DataCategory.BACKUP_OPERATION, offset, Order.ASC, VitamConfiguration.getRestoreBulkSize(), limit), VitamConfiguration.getRestoreBulkSize()); } }
RestoreBackupService { public Iterator<List<OfferLog>> getListing(String strategy, long offset, int limit) { LOGGER.info(String.format( "[Reconstruction]: Retrieve listing of {%s} Collection on {%s} Vitam strategy from {%s} offset with {%s} limit", DataCategory.BACKUP_OPERATION.name(), strategy, offset, limit)); return Iterators.partition( OfferLogHelper.getListing(storageClientFactory, strategy, DataCategory.BACKUP_OPERATION, offset, Order.ASC, VitamConfiguration.getRestoreBulkSize(), limit), VitamConfiguration.getRestoreBulkSize()); } RestoreBackupService(); @VisibleForTesting  RestoreBackupService(StorageClientFactory storageClientFactory); }
RestoreBackupService { public Iterator<List<OfferLog>> getListing(String strategy, long offset, int limit) { LOGGER.info(String.format( "[Reconstruction]: Retrieve listing of {%s} Collection on {%s} Vitam strategy from {%s} offset with {%s} limit", DataCategory.BACKUP_OPERATION.name(), strategy, offset, limit)); return Iterators.partition( OfferLogHelper.getListing(storageClientFactory, strategy, DataCategory.BACKUP_OPERATION, offset, Order.ASC, VitamConfiguration.getRestoreBulkSize(), limit), VitamConfiguration.getRestoreBulkSize()); } RestoreBackupService(); @VisibleForTesting  RestoreBackupService(StorageClientFactory storageClientFactory); Iterator<List<OfferLog>> getListing(String strategy, long offset, int limit); LogbookBackupModel loadData(String strategy, String filename,
        long offset); }
RestoreBackupService { public Iterator<List<OfferLog>> getListing(String strategy, long offset, int limit) { LOGGER.info(String.format( "[Reconstruction]: Retrieve listing of {%s} Collection on {%s} Vitam strategy from {%s} offset with {%s} limit", DataCategory.BACKUP_OPERATION.name(), strategy, offset, limit)); return Iterators.partition( OfferLogHelper.getListing(storageClientFactory, strategy, DataCategory.BACKUP_OPERATION, offset, Order.ASC, VitamConfiguration.getRestoreBulkSize(), limit), VitamConfiguration.getRestoreBulkSize()); } RestoreBackupService(); @VisibleForTesting  RestoreBackupService(StorageClientFactory storageClientFactory); Iterator<List<OfferLog>> getListing(String strategy, long offset, int limit); LogbookBackupModel loadData(String strategy, String filename,
        long offset);  }