S3DataTransferer implements DataTransfer { @Override public void retrieveProduct(Product product, File directory) throws DataTransferException, IOException { for (Reference ref : product.getProductReferences()) { GetObjectRequest request = new GetObjectRequest(bucketName, stripProtocol( ref.getDataStoreReference(), true)); S3Object file = s3Client.getObject(request); stageFile(file, ref, directory); } } S3DataTransferer(AmazonS3 s3Client, String bucketName, boolean encrypt); @Override void setFileManagerUrl(URL url); @Override void transferProduct(Product product); @Override void retrieveProduct(Product product, File directory); @Override void deleteProduct(Product product);  }
@Test public void testRetrieveProduct() throws DataTransferException, IOException { dataTransferer.retrieveProduct(product, stagingDir); ArgumentCaptor<GetObjectRequest> argument = ArgumentCaptor.forClass(GetObjectRequest.class); verify(s3Client).getObject(argument.capture()); GetObjectRequest request = argument.getValue(); assertThat(request.getBucketName(), is(S3_BUCKET_NAME)); assertThat(request.getKey(), is(EXPECTED_DATA_STORE_REF)); }