report.sendAWSToTestBucket();
final S3Object s3Object = report.postReportToAWSS3();
Assert.assertNotNull(s3Object, "Upload to AWS failed, s3Object was null. error was " + report.formatError());
// create a service with the public key, and make sure it cannot list or delete
final S3Service s3Service = GATKRunReport.initializeAWSService(GATKRunReport.getAWSUploadAccessKey(), GATKRunReport.getAWSUploadSecretKey());
assertOperationNotAllowed("listAllBuckets", new S3Op() {
@Override
public void apply() throws S3ServiceException {
s3Service.listAllBuckets();
}
});
assertOperationNotAllowed("listBucket", new S3Op() {
@Override
public void apply() throws S3ServiceException { s3Service.listObjects(report.getS3ReportBucket()); }
});
assertOperationNotAllowed("createBucket", new S3Op() {
@Override
public void apply() throws S3ServiceException { s3Service.createBucket("ShouldNotCreate"); }
});
assertOperationNotAllowed("deleteObject", new S3Op() {
@Override
public void apply() throws ServiceException { s3Service.deleteObject(report.getS3ReportBucket(), report.getReportFileName()); }
});
}