Repository: jclouds
Updated Branches:
  refs/heads/2.1.x 3dd8dfad5 -> c689d3175


JCLOUDS-1389: add GCS MPU multiregional test


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

Branch: refs/heads/2.1.x
Commit: c689d317580433e0289f4bd1dc54a1da9bf33a3b
Parents: 5fa2df1
Author: Andrew Gaul <[email protected]>
Authored: Sat Apr 21 12:16:55 2018 -0700
Committer: Andrew Gaul <[email protected]>
Committed: Sat Apr 21 13:27:22 2018 -0700

----------------------------------------------------------------------
 ...ogleCloudStorageBlobIntegrationLiveTest.java | 32 ++++++++++++++++++++
 1 file changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/c689d317/providers/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobIntegrationLiveTest.java
----------------------------------------------------------------------
diff --git 
a/providers/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobIntegrationLiveTest.java
 
b/providers/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobIntegrationLiveTest.java
index d1866a9..4a48b58 100644
--- 
a/providers/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobIntegrationLiveTest.java
+++ 
b/providers/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobIntegrationLiveTest.java
@@ -36,7 +36,12 @@ import org.jclouds.blobstore.domain.PageSet;
 import org.jclouds.blobstore.domain.StorageMetadata;
 import org.jclouds.blobstore.integration.internal.BaseBlobIntegrationTest;
 import org.jclouds.blobstore.options.PutOptions;
+import org.jclouds.googlecloud.config.CurrentProject;
 import org.jclouds.googlecloud.internal.TestProperties;
+import org.jclouds.googlecloudstorage.GoogleCloudStorageApi;
+import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Location;
+import 
org.jclouds.googlecloudstorage.domain.DomainResourceReferences.StorageClass;
+import org.jclouds.googlecloudstorage.domain.templates.BucketTemplate;
 import org.jclouds.io.Payloads;
 import org.jclouds.io.payloads.ByteSourcePayload;
 import org.jclouds.utils.TestUtils;
@@ -55,6 +60,7 @@ import com.google.common.io.Files;
 @Test(groups = { "live", "blobstorelive" })
 public class GoogleCloudStorageBlobIntegrationLiveTest extends 
BaseBlobIntegrationTest {
 
+   private final String PROJECT_NUMBER;
    private long PART_SIZE = 5L * 1024L * 1024L;
 
    @Override
@@ -64,6 +70,7 @@ public class GoogleCloudStorageBlobIntegrationLiveTest 
extends BaseBlobIntegrati
 
    public GoogleCloudStorageBlobIntegrationLiveTest() throws IOException {
       provider = "google-cloud-storage";
+      PROJECT_NUMBER = 
CurrentProject.ClientEmail.toProjectNumber(System.getProperty("test.google-cloud-storage.identity"));
    }
 
    @Override protected Properties setupProperties() {
@@ -331,4 +338,29 @@ public class GoogleCloudStorageBlobIntegrationLiveTest 
extends BaseBlobIntegrati
          throw new SkipException("GCS does not report storage class of 
composed objects", ae);
       }
    }
+
+   @Test(groups = { "integration", "live" })
+   public void testMultipartUploadSinglePartMultiRegional() throws Exception {
+      String containerName = "jclouds-multiregional";
+      BucketTemplate template = new BucketTemplate()
+            .name(containerName)
+            .location(Location.US)
+            .storageClass(StorageClass.COLDLINE);
+      GoogleCloudStorageApi api = view.unwrapApi(GoogleCloudStorageApi.class);
+      api.getBucketApi().createBucket(PROJECT_NUMBER, template);
+      String blobName = "multiregional-blobname";
+
+      try {
+         long length = 32 * 1024L;
+         ByteSource byteSource = TestUtils.randomByteSource().slice(0, length);
+         Blob blob = view.getBlobStore().blobBuilder(blobName)
+                 .payload(byteSource)
+                 .contentLength(length)
+                 .build();
+         view.getBlobStore().putBlob(containerName, blob, new 
PutOptions().multipart(true));
+      } finally {
+         view.getBlobStore().removeBlob(containerName, blobName);
+         api.getBucketApi().deleteBucket(containerName);
+      }
+   }
 }

Reply via email to