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/f7b45341 Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/f7b45341 Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/f7b45341 Branch: refs/heads/master Commit: f7b45341328410dea583901a31218a3588cb5aad Parents: def6db4 Author: Andrew Gaul <[email protected]> Authored: Sat Apr 21 12:16:55 2018 -0700 Committer: Andrew Gaul <[email protected]> Committed: Sat Apr 21 13:25:00 2018 -0700 ---------------------------------------------------------------------- ...ogleCloudStorageBlobIntegrationLiveTest.java | 32 ++++++++++++++++++++ 1 file changed, 32 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7b45341/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); + } + } }
