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:39 UTC

[jclouds] fix range get for manifest object (#765)

swift doesn't return the etag if the client is doing a range
get of a manifest (SLO or DLO), this fixes SwiftObject so
etag is optional
You can view, comment on, or merge this pull request online at:

  https://github.com/jclouds/jclouds/pull/765

-- Commit Summary --

  * fix range get for manifest object

-- File Changes --

    M apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/domain/SwiftObject.java (2)
    M blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java (19)

-- Patch Links --

https://github.com/jclouds/jclouds/pull/765.patch
https://github.com/jclouds/jclouds/pull/765.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/765

Re: [jclouds] fix range get for manifest object (#765)

Posted by Ka-Hing Cheung <no...@github.com>.
> +   @Test(groups = { "integration", "live" })
> +   public void testGetRangeMultipart() throws InterruptedException, IOException {
> +      String container = getContainerName();
> +      try {
> +         String name = "apples";
> +         long length = getMinimumMultipartBlobSize();
> +         ByteSource byteSource = TestUtils.randomByteSource().slice(0, length);
> +         Blob blob = view.getBlobStore().blobBuilder(name)
> +                 .payload(byteSource)
> +                 .contentLength(length)
> +                 .build();
> +         view.getBlobStore().putBlob(container, blob, new PutOptions().multipart(true));
> +         blob = view.getBlobStore().getBlob(container, name, range(0, 5));
> +         validateMetadata(blob.getMetadata(), container, name);
> +         assertThat(blob.getPayload().openStream())
> +                 .hasContentEqualTo(byteSource.slice(0, 6).openStream());

done

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/765/files#r32163677

Re: [jclouds] fix range get for manifest object (#765)

Posted by Andrew Gaul <no...@github.com>.
> @@ -427,6 +427,25 @@ public void testGetTwoRanges() throws InterruptedException, IOException {
>        }
>     }
>  
> +   @Test(groups = { "integration", "live" })
> +   public void testGetRangeMultipart() throws InterruptedException, IOException {
> +      String container = getContainerName();
> +      try {
> +         String name = "apples";
> +         long length = getMinimumMultipartBlobSize();
> +         ByteSource byteSource = TestUtils.randomByteSource().slice(0, length);
> +         Blob blob = view.getBlobStore().blobBuilder(name)
> +                 .payload(byteSource)
> +                 .contentLength(length)
> +                 .build();
> +         view.getBlobStore().putBlob(container, blob, new PutOptions().multipart(true));
> +         blob = view.getBlobStore().getBlob(container, name, range(0, 5));
> +         validateMetadata(blob.getMetadata(), container, name);

Compare the `blob` payload against the partial `byteSource`?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/765/files#r32080195

Re: [jclouds] fix range get for manifest object (#765)

Posted by Ka-Hing Cheung <no...@github.com>.
> @@ -427,6 +427,25 @@ public void testGetTwoRanges() throws InterruptedException, IOException {
>        }
>     }
>  
> +   @Test(groups = { "integration", "live" })
> +   public void testGetRangeMultipart() throws InterruptedException, IOException {
> +      String container = getContainerName();
> +      try {
> +         String name = "apples";
> +         long length = getMinimumMultipartBlobSize();
> +         ByteSource byteSource = TestUtils.randomByteSource().slice(0, length);
> +         Blob blob = view.getBlobStore().blobBuilder(name)
> +                 .payload(byteSource)
> +                 .contentLength(length)
> +                 .build();
> +         view.getBlobStore().putBlob(container, blob, new PutOptions().multipart(true));
> +         blob = view.getBlobStore().getBlob(container, name, range(0, 5));
> +         validateMetadata(blob.getMetadata(), container, name);

done

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/765/files#r32081542

Re: [jclouds] fix range get for manifest object (#765)

Posted by Andrew Gaul <no...@github.com>.
> +   @Test(groups = { "integration", "live" })
> +   public void testGetRangeMultipart() throws InterruptedException, IOException {
> +      String container = getContainerName();
> +      try {
> +         String name = "apples";
> +         long length = getMinimumMultipartBlobSize();
> +         ByteSource byteSource = TestUtils.randomByteSource().slice(0, length);
> +         Blob blob = view.getBlobStore().blobBuilder(name)
> +                 .payload(byteSource)
> +                 .contentLength(length)
> +                 .build();
> +         view.getBlobStore().putBlob(container, blob, new PutOptions().multipart(true));
> +         blob = view.getBlobStore().getBlob(container, name, range(0, 5));
> +         validateMetadata(blob.getMetadata(), container, name);
> +         assertThat(blob.getPayload().openStream())
> +                 .hasContentEqualTo(byteSource.slice(0, 6).openStream());

Wrap these in try-with-resources to close the socket?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/765/files#r32090156