S3PrefixFileExplorer extends S3FileExplorer { @Override public void addToBuilder(final FileList.Builder builder) { do { final List<S3ObjectSummary> s3ObjectSummaries = fetch(); for (final S3ObjectSummary s : s3ObjectSummaries) { if (s.getStorageClass().equals(StorageClass.Glacier.toString())) { if (skipGlacierObjects) { LOGGER.warn("Skipped \"s3: continue; } throw new ConfigException("Detected an object stored at Glacier. Set \"skip_glacier_objects\" option to \"true\" to skip this."); } if (s.getSize() > 0) { builder.add(s.getKey(), s.getSize()); if (!builder.needsMore()) { LOGGER.warn("Too many files matched, stop listing file"); return; } } } } while (hasNext()); } S3PrefixFileExplorer(final String bucketName, final AmazonS3 s3Client, final RetryExecutor retryExecutor, final String pathPrefix, final boolean skipGlacierObjects); @Override void addToBuilder(final FileList.Builder builder);  }
@Test(expected = ConfigException.class) public void addToBuilder_should_throw_exception_if_notskipped_glacier_storage() { when(s3ObjectSummary.getStorageClass()).thenReturn(StorageClass.Glacier.toString()); s3PrefixFileExplorer.addToBuilder(builder); }