You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Ka-Hing Cheung <no...@github.com> on 2015/06/10 02:28:51 UTC
[jclouds] fix multipart put of a blob with content md5 (#766)
previously the parts will carry the content md5 of the entire
object, because unsetting the md5 of a ContentMetadata actually
didn't do anything
You can view, comment on, or merge this pull request online at:
https://github.com/jclouds/jclouds/pull/766
-- Commit Summary --
* fix multipart put of a blob with content md5
-- File Changes --
M blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java (14)
M core/src/main/java/org/jclouds/io/ContentMetadataBuilder.java (2)
-- Patch Links --
https://github.com/jclouds/jclouds/pull/766.patch
https://github.com/jclouds/jclouds/pull/766.diff
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/766
Re: [jclouds] fix multipart put of a blob with content md5 (#766)
Posted by Ka-Hing Cheung <no...@github.com>.
> ByteSource byteSource = TestUtils.randomByteSource().slice(0, length);
> Payload payload = new ByteSourcePayload(byteSource);
> + payload.getContentMetadata().setContentMD5(Hashing.md5().hashBytes(byteSource.read()));
done
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/766/files#r32080582
Re: [jclouds] fix multipart put of a blob with content md5 (#766)
Posted by Ka-Hing Cheung <no...@github.com>.
> @@ -601,9 +603,16 @@ public void testPutInputStream() throws Exception {
>
> @Test(groups = { "integration", "live" })
> public void testPutMultipartByteSource() throws Exception {
> - long length = getMinimumMultipartBlobSize();
> + long length = 33554432 + 1; // MultipartUploadSlicingAlgorithm.DEFAULT_PART_SIZE + 1
done
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/766/files#r32080595
Re: [jclouds] fix multipart put of a blob with content md5 (#766)
Posted by Andrew Gaul <no...@github.com>.
> ByteSource byteSource = TestUtils.randomByteSource().slice(0, length);
> Payload payload = new ByteSourcePayload(byteSource);
> + payload.getContentMetadata().setContentMD5(Hashing.md5().hashBytes(byteSource.read()));
You can hash without buffering via: `byteSource.hash(Hashing.md5())`
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/766/files#r32079763
Re: [jclouds] fix multipart put of a blob with content md5 (#766)
Posted by Ka-Hing Cheung <no...@github.com>.
> @@ -649,6 +658,9 @@ private void testPut(Payload payload, Payload expectedPayload, long length, PutO
> .payload(payload)
> .contentLength(length);
> addContentMetadata(blobBuilder);
> + if (payload.getContentMetadata().getContentMD5AsHashCode() != null) {
> + blobBuilder.contentMD5(payload.getContentMetadata().getContentMD5AsHashCode());
done
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/766/files#r32080587
Re: [jclouds] fix multipart put of a blob with content md5 (#766)
Posted by Andrew Gaul <no...@github.com>.
> @@ -649,6 +658,9 @@ private void testPut(Payload payload, Payload expectedPayload, long length, PutO
> .payload(payload)
> .contentLength(length);
> addContentMetadata(blobBuilder);
> + if (payload.getContentMetadata().getContentMD5AsHashCode() != null) {
> + blobBuilder.contentMD5(payload.getContentMetadata().getContentMD5AsHashCode());
Pass in `HashCode` as a parameter instead of storing it in the `Payload`?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/766/files#r32079808
Re: [jclouds] fix multipart put of a blob with content md5 (#766)
Posted by Andrew Gaul <no...@github.com>.
Pushed to master as 140fb7ea7b55b02e26307a29fb7724ca9d4ad94b.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/766#issuecomment-110603472
Re: [jclouds] fix multipart put of a blob with content md5 (#766)
Posted by Andrew Gaul <no...@github.com>.
> @@ -601,9 +603,16 @@ public void testPutInputStream() throws Exception {
>
> @Test(groups = { "integration", "live" })
> public void testPutMultipartByteSource() throws Exception {
> - long length = getMinimumMultipartBlobSize();
> + long length = 33554432 + 1; // MultipartUploadSlicingAlgorithm.DEFAULT_PART_SIZE + 1
> + BlobStore blobStore = view.getBlobStore();
> + MultipartUploadSlicingAlgorithm algorithm = new MultipartUploadSlicingAlgorithm(
> + getMinimumMultipartBlobSize(), blobStore.getMaximumMultipartPartSize(),
Call `blobStore.getMinimumMultipartBlobSize` instead? We should remove the test-specific variants now the `BlobStore` supports this.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/766/files#r32079892
Re: [jclouds] fix multipart put of a blob with content md5 (#766)
Posted by Ka-Hing Cheung <no...@github.com>.
> @@ -601,9 +603,16 @@ public void testPutInputStream() throws Exception {
>
> @Test(groups = { "integration", "live" })
> public void testPutMultipartByteSource() throws Exception {
> - long length = getMinimumMultipartBlobSize();
> + long length = 33554432 + 1; // MultipartUploadSlicingAlgorithm.DEFAULT_PART_SIZE + 1
> + BlobStore blobStore = view.getBlobStore();
> + MultipartUploadSlicingAlgorithm algorithm = new MultipartUploadSlicingAlgorithm(
> + getMinimumMultipartBlobSize(), blobStore.getMaximumMultipartPartSize(),
done
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/766/files#r32080602
Re: [jclouds] fix multipart put of a blob with content md5 (#766)
Posted by Andrew Gaul <no...@github.com>.
Closed #766.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/766#event-327063269
Re: [jclouds] fix multipart put of a blob with content md5 (#766)
Posted by Andrew Gaul <no...@github.com>.
> @@ -601,9 +603,16 @@ public void testPutInputStream() throws Exception {
>
> @Test(groups = { "integration", "live" })
> public void testPutMultipartByteSource() throws Exception {
> - long length = getMinimumMultipartBlobSize();
> + long length = 33554432 + 1; // MultipartUploadSlicingAlgorithm.DEFAULT_PART_SIZE + 1
Can you expand this to: `32 * 1024 * 1024 + 1`?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/766/files#r32079822