assertEquals("Target bucket", bucketName, loggingStatus.getTargetBucketName());
assertEquals("Log file prefix", "access-log-", loggingStatus.getLogfilePrefix());
// Add TargetGrants ACLs for log files (S3 only)
if (!(service instanceof GoogleStorageService)) {
((S3BucketLoggingStatus)newLoggingStatus).addTargetGrant(new GrantAndPermission(
GroupGrantee.ALL_USERS, Permission.PERMISSION_READ));
((S3BucketLoggingStatus)newLoggingStatus).addTargetGrant(new GrantAndPermission(
GroupGrantee.AUTHENTICATED_USERS, Permission.PERMISSION_READ_ACP));
((S3Service)service)
.setBucketLoggingStatus(bucket.getName(), (S3BucketLoggingStatus)newLoggingStatus, true);
loggingStatus = ((S3Service)service)
.getBucketLoggingStatus(bucket.getName());
assertEquals(2, ((S3BucketLoggingStatus)loggingStatus).getTargetGrants().length);
GrantAndPermission gap = ((S3BucketLoggingStatus)loggingStatus).getTargetGrants()[0];
assertEquals(gap.getGrantee().getIdentifier(), GroupGrantee.ALL_USERS.getIdentifier());
assertEquals(gap.getPermission(), Permission.PERMISSION_READ);
gap = ((S3BucketLoggingStatus)loggingStatus).getTargetGrants()[1];
assertEquals(gap.getGrantee().getIdentifier(), GroupGrantee.AUTHENTICATED_USERS.getIdentifier());
assertEquals(gap.getPermission(), Permission.PERMISSION_READ_ACP);
}
// Disable logging
newLoggingStatus = getBucketLoggingStatus(null, null);
if (service instanceof GoogleStorageService) {