S3BinaryStore extends AbstractBinaryStore { @Override public Iterable<BinaryKey> getAllBinaryKeys() throws BinaryStoreException { try { final Supplier<Stream<S3ObjectSummary>> streamSupplier = supplyObjects(); return () -> streamSupplier.get().map(S3ObjectSummary::getKey).map(BinaryKey::new).iterator(); } catch (AmazonClientException e) { throw new BinaryStoreException(e); } } S3BinaryStore(String accessKey, String secretKey, String bucketName);  S3BinaryStore(String accessKey, String secretKey, String bucketName, String endPoint);  S3BinaryStore( String accessKey,
                          String secretKey,
                          String bucketName,
                          String endPoint,
                          Boolean deleteUnusedNatively ); protected  S3BinaryStore(String bucketName, AmazonS3 s3Client, boolean deleteUnusedNatively); @Override void storeExtractedText(BinaryValue binaryValue, String extractedText); @Override String getExtractedText(BinaryValue binaryValue); @Override BinaryValue storeValue(InputStream stream, boolean markAsUnused); @Override InputStream getInputStream(BinaryKey key); @Override void markAsUsed(Iterable<BinaryKey> keys); @Override void markAsUnused(Iterable<BinaryKey> keys); @Override void removeValuesUnusedLongerThan(long minimumAge, TimeUnit timeUnit); @Override Iterable<BinaryKey> getAllBinaryKeys(); void migrateUnusedMetadataToTags();  }
@Test public void testGetAllBinaryKeys() throws BinaryStoreException { List<S3ObjectSummary> objectList = new ArrayList<>(); for (int i = 0; i < 101; i++) { S3ObjectSummary object = new S3ObjectSummary(); object.setKey(String.valueOf(i)); objectList.add(object); } expect(s3Client.listObjects(isA(ListObjectsRequest.class))) .andReturn(objectListing); expect(objectListing.getObjectSummaries()).andReturn(objectList); expect(objectListing.isTruncated()).andReturn(true); expect(s3Client.listNextBatchOfObjects(objectListing)) .andReturn(objectListing); expect(objectListing.getObjectSummaries()).andReturn(objectList); expect(objectListing.isTruncated()).andReturn(false); expect(objectListing.isTruncated()).andReturn(false); replayAll(); final AtomicInteger keyCount = new AtomicInteger(); s3BinaryStore.getAllBinaryKeys().forEach(k -> keyCount.incrementAndGet()); assertEquals(202, keyCount.get()); }