@RunWithCustomExecutor @Test public void should_get_listing_when_listing_objects_returns_response_ok() throws Exception { String containerName = String.format("%s_%s", TENANT_ID_0, DataCategory.BACKUP_OPERATION.getFolder()); when( distribution.getOfferLogsByOfferId(VitamConfiguration.getDefaultStrategy(), OFFER_ID, DataCategory.BACKUP_OPERATION, 10L, 2, Order.ASC)) .thenReturn(getOfferLogsListing(containerName, 10L, 2L)); List<OfferLog> offerLogListing = restoreOfferBackupService .getListing(VitamConfiguration.getDefaultStrategy(), OFFER_ID, DataCategory.BACKUP_OPERATION, 10L, 2, Order.ASC); assertThat(offerLogListing).hasSize(2); assertThat(offerLogListing.get(0).getContainer()).isEqualTo(containerName); assertThat(offerLogListing.get(0).getFileName()).isEqualTo(FILE_NAME + "10"); assertThat(offerLogListing.get(1).getFileName()).isEqualTo(FILE_NAME + "11"); containerName = String.format("%s_%s", TENANT_ID_0, DataCategory.OBJECTGROUP.getFolder()); when( distribution.getOfferLogsByOfferId(VitamConfiguration.getDefaultStrategy(), OFFER_ID, DataCategory.OBJECTGROUP, 100L, 3, Order.DESC)) .thenReturn(getOfferLogsListing(containerName, 100L, 3L)); offerLogListing = restoreOfferBackupService.getListing(VitamConfiguration.getDefaultStrategy(), OFFER_ID, DataCategory.OBJECTGROUP, 100L, 3, Order.DESC); assertThat(offerLogListing).isNotNull().isNotEmpty(); assertThat(offerLogListing).hasSize(3); assertThat(offerLogListing.get(0).getContainer()).isEqualTo(containerName); assertThat(offerLogListing.get(0).getFileName()).isEqualTo(FILE_NAME + "100"); assertThat(offerLogListing.get(1).getFileName()).isEqualTo(FILE_NAME + "101"); assertThat(offerLogListing.get(2).getFileName()).isEqualTo(FILE_NAME + "102"); }
public List<OfferLog> getListing(String strategy, String offerId, DataCategory category, Long offset, int limit, Order order) throws StorageException { LOGGER.debug(String.format( "[Offer synchronization]: Retrieve listing of {%s} dataCategory from {%s} offer, with {%s} Vitam strategy from {%s} offset with {%s} limit", category.name(), offerId, strategy, offset, limit)); RequestResponse<OfferLog> result = distribution.getOfferLogsByOfferId(strategy, offerId, category, offset, limit, order); if (!result.isOk()) { throw new StorageException( String.format("ERROR: VitamError has been returned when using storage service: {%s}", result.toString())); } return ((RequestResponseOK<OfferLog>) result).getResults(); }
RestoreOfferBackupService { public List<OfferLog> getListing(String strategy, String offerId, DataCategory category, Long offset, int limit, Order order) throws StorageException { LOGGER.debug(String.format( "[Offer synchronization]: Retrieve listing of {%s} dataCategory from {%s} offer, with {%s} Vitam strategy from {%s} offset with {%s} limit", category.name(), offerId, strategy, offset, limit)); RequestResponse<OfferLog> result = distribution.getOfferLogsByOfferId(strategy, offerId, category, offset, limit, order); if (!result.isOk()) { throw new StorageException( String.format("ERROR: VitamError has been returned when using storage service: {%s}", result.toString())); } return ((RequestResponseOK<OfferLog>) result).getResults(); } }
RestoreOfferBackupService { public List<OfferLog> getListing(String strategy, String offerId, DataCategory category, Long offset, int limit, Order order) throws StorageException { LOGGER.debug(String.format( "[Offer synchronization]: Retrieve listing of {%s} dataCategory from {%s} offer, with {%s} Vitam strategy from {%s} offset with {%s} limit", category.name(), offerId, strategy, offset, limit)); RequestResponse<OfferLog> result = distribution.getOfferLogsByOfferId(strategy, offerId, category, offset, limit, order); if (!result.isOk()) { throw new StorageException( String.format("ERROR: VitamError has been returned when using storage service: {%s}", result.toString())); } return ((RequestResponseOK<OfferLog>) result).getResults(); } RestoreOfferBackupService(StorageDistribution distribution); }
RestoreOfferBackupService { public List<OfferLog> getListing(String strategy, String offerId, DataCategory category, Long offset, int limit, Order order) throws StorageException { LOGGER.debug(String.format( "[Offer synchronization]: Retrieve listing of {%s} dataCategory from {%s} offer, with {%s} Vitam strategy from {%s} offset with {%s} limit", category.name(), offerId, strategy, offset, limit)); RequestResponse<OfferLog> result = distribution.getOfferLogsByOfferId(strategy, offerId, category, offset, limit, order); if (!result.isOk()) { throw new StorageException( String.format("ERROR: VitamError has been returned when using storage service: {%s}", result.toString())); } return ((RequestResponseOK<OfferLog>) result).getResults(); } RestoreOfferBackupService(StorageDistribution distribution); List<OfferLog> getListing(String strategy, String offerId, DataCategory category, Long offset,
        int limit, Order order); }
RestoreOfferBackupService { public List<OfferLog> getListing(String strategy, String offerId, DataCategory category, Long offset, int limit, Order order) throws StorageException { LOGGER.debug(String.format( "[Offer synchronization]: Retrieve listing of {%s} dataCategory from {%s} offer, with {%s} Vitam strategy from {%s} offset with {%s} limit", category.name(), offerId, strategy, offset, limit)); RequestResponse<OfferLog> result = distribution.getOfferLogsByOfferId(strategy, offerId, category, offset, limit, order); if (!result.isOk()) { throw new StorageException( String.format("ERROR: VitamError has been returned when using storage service: {%s}", result.toString())); } return ((RequestResponseOK<OfferLog>) result).getResults(); } RestoreOfferBackupService(StorageDistribution distribution); List<OfferLog> getListing(String strategy, String offerId, DataCategory category, Long offset,
        int limit, Order order);  }