@Test public void testOffsetAndLimitV2OfferLogs() throws Exception { List<Integer> filesOffsets = Arrays.asList(10, 20, 30, 40, 50, 60, 70, 80, 90, 100); givenOfferLogOffsets(filesOffsets); Iterator<OfferLog> offerLogIterator = OfferLogHelper.getListing(storageClientFactory, VitamConfiguration.getDefaultStrategy(), DataCategory.UNIT, 20L, Order.ASC, 5, 7); assertThat(offerLogIterator) .extracting(OfferLog::getFileName) .containsExactly("file20", "file30", "file40", "file50", "file60", "file70", "file80"); verify(storageClient, times(2)) .getOfferLogs(eq(VitamConfiguration.getDefaultStrategy()), eq(DataCategory.UNIT), anyLong(), anyInt(), eq(Order.ASC)); }
public static Iterator<OfferLog> getListing(StorageClientFactory storageClientFactory, String strategy, DataCategory dataCategory, Long offset, Order order, int chunkSize, Integer limit) { int actualChunkSize = limit == null ? chunkSize : Math.min(chunkSize, limit); Iterator<OfferLog> offerLogIterator = new StorageClientOfferLogIterator( storageClientFactory, strategy, order, dataCategory, actualChunkSize, offset); if (limit != null) { offerLogIterator = IteratorUtils.boundedIterator(offerLogIterator, limit); } return offerLogIterator; }
OfferLogHelper { public static Iterator<OfferLog> getListing(StorageClientFactory storageClientFactory, String strategy, DataCategory dataCategory, Long offset, Order order, int chunkSize, Integer limit) { int actualChunkSize = limit == null ? chunkSize : Math.min(chunkSize, limit); Iterator<OfferLog> offerLogIterator = new StorageClientOfferLogIterator( storageClientFactory, strategy, order, dataCategory, actualChunkSize, offset); if (limit != null) { offerLogIterator = IteratorUtils.boundedIterator(offerLogIterator, limit); } return offerLogIterator; } }
OfferLogHelper { public static Iterator<OfferLog> getListing(StorageClientFactory storageClientFactory, String strategy, DataCategory dataCategory, Long offset, Order order, int chunkSize, Integer limit) { int actualChunkSize = limit == null ? chunkSize : Math.min(chunkSize, limit); Iterator<OfferLog> offerLogIterator = new StorageClientOfferLogIterator( storageClientFactory, strategy, order, dataCategory, actualChunkSize, offset); if (limit != null) { offerLogIterator = IteratorUtils.boundedIterator(offerLogIterator, limit); } return offerLogIterator; }  }
OfferLogHelper { public static Iterator<OfferLog> getListing(StorageClientFactory storageClientFactory, String strategy, DataCategory dataCategory, Long offset, Order order, int chunkSize, Integer limit) { int actualChunkSize = limit == null ? chunkSize : Math.min(chunkSize, limit); Iterator<OfferLog> offerLogIterator = new StorageClientOfferLogIterator( storageClientFactory, strategy, order, dataCategory, actualChunkSize, offset); if (limit != null) { offerLogIterator = IteratorUtils.boundedIterator(offerLogIterator, limit); } return offerLogIterator; }  static Iterator<OfferLog> getListing(StorageClientFactory storageClientFactory, String strategy,
        DataCategory dataCategory, Long offset, Order order, int chunkSize, Integer limit); }
OfferLogHelper { public static Iterator<OfferLog> getListing(StorageClientFactory storageClientFactory, String strategy, DataCategory dataCategory, Long offset, Order order, int chunkSize, Integer limit) { int actualChunkSize = limit == null ? chunkSize : Math.min(chunkSize, limit); Iterator<OfferLog> offerLogIterator = new StorageClientOfferLogIterator( storageClientFactory, strategy, order, dataCategory, actualChunkSize, offset); if (limit != null) { offerLogIterator = IteratorUtils.boundedIterator(offerLogIterator, limit); } return offerLogIterator; }  static Iterator<OfferLog> getListing(StorageClientFactory storageClientFactory, String strategy,
        DataCategory dataCategory, Long offset, Order order, int chunkSize, Integer limit);  }