Package org.jets3t.service.model

Examples of org.jets3t.service.model.StorageBucketLoggingStatus


        try {
            StorageBucket bucket = createBucketForTest("testBucketLogging");
            String bucketName = bucket.getName();

            // Check logging status is false
            StorageBucketLoggingStatus loggingStatus = null;
            if (service instanceof GoogleStorageService) {
                loggingStatus = ((GoogleStorageService)service)
                    .getBucketLoggingStatus(bucket.getName());
            } else {
                loggingStatus = ((S3Service)service)
                    .getBucketLoggingStatus(bucket.getName());
            }
            assertFalse("Expected logging to be disabled for bucket " + bucketName,
                loggingStatus.isLoggingEnabled());

            // Enable logging (non-existent target bucket)
            // NOTE: throws Exception with S3, but not with GS!
            try {
                StorageBucketLoggingStatus newLoggingStatus = getBucketLoggingStatus(
                    getCredentials().getAccessKey() + ".NonExistentBucketName", "access-log-");
                if (service instanceof GoogleStorageService) {
                    ((GoogleStorageService)service)
                        .setBucketLoggingStatus(bucket.getName(), (GSBucketLoggingStatus)newLoggingStatus);
                } else {
                    ((S3Service)service)
                        .setBucketLoggingStatus(bucket.getName(), (S3BucketLoggingStatus)newLoggingStatus, true);
                    fail("Using non-existent target bucket should have caused an exception");
                }
            } catch (Exception e) {
            }

            // Enable logging (in same bucket)
            StorageBucketLoggingStatus newLoggingStatus = getBucketLoggingStatus(bucketName, "access-log-");
            if (service instanceof GoogleStorageService) {
                ((GoogleStorageService)service)
                    .setBucketLoggingStatus(bucket.getName(), (GSBucketLoggingStatus)newLoggingStatus);
            } else {
                ((S3Service)service)
View Full Code Here

TOP

Related Classes of org.jets3t.service.model.StorageBucketLoggingStatus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.