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 2017/08/06 20:51:40 UTC
[1/2] jclouds git commit: JCLOUDS-1327: Add tests for zero-length
blobs
Repository: jclouds
Updated Branches:
refs/heads/master d07c4a215 -> 9e73bbec1
JCLOUDS-1327: Add tests for zero-length blobs
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/d6038487
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/d6038487
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/d6038487
Branch: refs/heads/master
Commit: d6038487f7d4256f73dd089c9bc8d307fbae0aff
Parents: d07c4a2
Author: Chaithanya Ganta <ga...@adobe.com>
Authored: Thu Jul 20 18:40:26 2017 +0530
Committer: Andrew Gaul <ga...@apache.org>
Committed: Sun Aug 6 13:51:07 2017 -0700
----------------------------------------------------------------------
.../internal/BaseBlobIntegrationTest.java | 15 +++++++++++++++
1 file changed, 15 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/d6038487/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java
----------------------------------------------------------------------
diff --git a/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java b/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java
index 5aee9f7..d3e6c1b 100644
--- a/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java
+++ b/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java
@@ -640,6 +640,21 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
}
@Test(groups = { "integration", "live" })
+ public void testPutZeroLengthByteSource() throws Exception {
+ long length = 0;
+ Payload payload = new ByteSourcePayload(ByteSource.empty());
+ testPut(payload, null, payload, length, new PutOptions());
+ }
+
+ @Test(groups = { "integration", "live" })
+ public void testPutZeroLengthInputStream() throws Exception {
+ long length = 0;
+ ByteSource byteSource = ByteSource.empty();
+ Payload payload = new InputStreamPayload(byteSource.openStream());
+ testPut(payload, null, payload, length, new PutOptions());
+ }
+
+ @Test(groups = { "integration", "live" })
public void testPutMultipartByteSource() throws Exception {
long length = Math.max(getMinimumMultipartBlobSize(), MultipartUploadSlicingAlgorithm.DEFAULT_PART_SIZE + 1);
BlobStore blobStore = view.getBlobStore();
[2/2] jclouds git commit: JCLOUDS-1327: Do not try GCS MPU if length
is zero
Posted by ga...@apache.org.
JCLOUDS-1327: Do not try GCS MPU if length is zero
References JCLOUDS-912.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/9e73bbec
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/9e73bbec
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/9e73bbec
Branch: refs/heads/master
Commit: 9e73bbec16cbf91c5f228d4c3ae99c6c526081f8
Parents: d603848
Author: Andrew Gaul <ga...@apache.org>
Authored: Sun Aug 6 13:13:15 2017 -0700
Committer: Andrew Gaul <ga...@apache.org>
Committed: Sun Aug 6 13:51:08 2017 -0700
----------------------------------------------------------------------
.../blobstore/GoogleCloudStorageBlobStore.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/9e73bbec/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobStore.java
----------------------------------------------------------------------
diff --git a/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobStore.java b/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobStore.java
index c86dcc8..b58f25c 100644
--- a/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobStore.java
+++ b/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobStore.java
@@ -215,13 +215,13 @@ public final class GoogleCloudStorageBlobStore extends BaseBlobStore {
@Override
public String putBlob(String container, Blob blob, PutOptions options) {
- if (options.isMultipart() || !blob.getPayload().isRepeatable()) {
+ long length = checkNotNull(blob.getPayload().getContentMetadata().getContentLength());
+
+ if (length != 0 && (options.isMultipart() || !blob.getPayload().isRepeatable())) {
// JCLOUDS-912 prevents using single-part uploads with InputStream payloads.
// Work around this with multi-part upload which buffers parts in-memory.
return putMultipartBlob(container, blob, options);
} else {
- checkNotNull(blob.getPayload().getContentMetadata().getContentLength());
-
ObjectTemplate template = blobMetadataToObjectTemplate.apply(blob.getMetadata());
HashCode md5 = blob.getMetadata().getContentMetadata().getContentMD5AsHashCode();