You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ga...@apache.org on 2015/04/01 22:13:29 UTC

[2/2] jclouds-labs-google git commit: JCLOUDS-848: Add tests for storage classes

JCLOUDS-848: Add tests for storage classes


Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/commit/4e8858a4
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/tree/4e8858a4
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/diff/4e8858a4

Branch: refs/heads/master
Commit: 4e8858a472104c6904f35e94fa5889906582813e
Parents: 2455f94
Author: Andrew Gaul <ga...@apache.org>
Authored: Wed Apr 1 11:12:01 2015 -0700
Committer: Andrew Gaul <ga...@apache.org>
Committed: Wed Apr 1 13:12:26 2015 -0700

----------------------------------------------------------------------
 .../features/BucketApiLiveTest.java             | 39 ++++++++++++++++++++
 1 file changed, 39 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/4e8858a4/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketApiLiveTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketApiLiveTest.java
index 21f0a18..762e7f2 100644
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketApiLiveTest.java
+++ b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketApiLiveTest.java
@@ -16,6 +16,7 @@
  */
 package org.jclouds.googlecloudstorage.features;
 
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNotNull;
@@ -51,8 +52,14 @@ import com.google.common.collect.Lists;
 
 public class BucketApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
 
+   // TODO: what removes these buckets?
+
    private static final String BUCKET_NAME = "jcloudstestbucket" + (int) (Math.random() * 10000);
 
+   private static final String BUCKET_NAME_STANDARD = "jcloudstestbucketstandard" + (int) (Math.random() * 10000);
+
+   private static final String BUCKET_NAME_NEARLINE = "jcloudstestbucketnearline" + (int) (Math.random() * 10000);
+
    private static final String BUCKET_NAME_WITHOPTIONS = "jcloudtestbucketoptions" + (int) (Math.random() * 10000);
 
    private static final String LOG_BUCKET_NAME = "jcloudslogbucket" + (int) (Math.random() * 10000);
@@ -63,6 +70,7 @@ public class BucketApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
       return api.getBucketApi();
    }
 
+   // TODO: should this test use STANDARD storage class?
    @Test(groups = "live")
    public void testCreateBucket() {
 
@@ -91,9 +99,40 @@ public class BucketApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
       assertTrue(response.cors().size() == 1);
       assertEquals(response.name(), BUCKET_NAME);
       assertEquals(response.location(), Location.US_CENTRAL2);
+      assertThat(response.storageClass()).isEqualTo(StorageClass.DURABLE_REDUCED_AVAILABILITY);
       assertTrue(response.versioning().enabled());
    }
 
+   @Test(groups = "live")
+   public void testCreateBucketStandard() {
+      BucketTemplate template = new BucketTemplate()
+               .name(BUCKET_NAME_STANDARD)
+               .location(Location.US)
+               .storageClass(StorageClass.STANDARD);
+
+      Bucket response = api().createBucket(PROJECT_NUMBER, template);
+
+      assertNotNull(response);
+      assertEquals(response.name(), BUCKET_NAME_STANDARD);
+      assertEquals(response.location(), Location.US);
+      assertThat(response.storageClass()).isEqualTo(StorageClass.STANDARD);
+   }
+
+   @Test(groups = "live")
+   public void testCreateBucketNearline() {
+      BucketTemplate template = new BucketTemplate()
+               .name(BUCKET_NAME_NEARLINE)
+               .location(Location.US)
+               .storageClass(StorageClass.NEARLINE);
+
+      Bucket response = api().createBucket(PROJECT_NUMBER, template);
+
+      assertNotNull(response);
+      assertEquals(response.name(), BUCKET_NAME_NEARLINE);
+      assertEquals(response.location(), Location.US);
+      assertThat(response.storageClass()).isEqualTo(StorageClass.NEARLINE);
+   }
+
    @Test(groups = "live", dependsOnMethods = { "testCreateBucket" })
    public void testCreateAlreadyExistBucket() {