Skip to content

Commit

Permalink
Merge pull request #8 from gcheng/Jerusalem
Browse files Browse the repository at this point in the history
Merge the MD5 update to dev for.
  • Loading branch information
Albert Cheng committed Jul 30, 2012
2 parents 0040bcf + a542866 commit 796a21a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,9 @@ public GetBlobResult getBlob(String container, String blob, GetBlobOptions optio
builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId());
builder = addOptionalRangeHeader(builder, options.getRangeStart(), options.getRangeEnd());
builder = addOptionalAccessContitionHeader(builder, options.getAccessCondition());
if (options.isComputeRangeMD5()) {
builder = addOptionalHeader(builder, "x-ms-range-get-content-md5", "true");
}

ClientResponse response = builder.get(ClientResponse.class);
ThrowIfNotSuccess(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,32 @@ public void getBlobWithIfNotModifiedSinceAccessConditionWorks() throws Exception
// Assert
}

@Test
public void getBlobWithMD5Range() throws Exception {
// Arrange
Configuration config = createConfiguration();
BlobContract service = BlobService.create(config);
String expectedMd5 = "+zxkkqBt6HehE3r5suhS1w==";

// Act
String container = TEST_CONTAINER_FOR_BLOBS;
String blob = "test";
service.createPageBlob(container, blob, 4096);

GetBlobOptions options = new GetBlobOptions();
options = options.setRangeStart(50L);
options = options.setRangeEnd(200L);
options = options.setComputeRangeMD5(true);
GetBlobResult getBlobResult = service.getBlob(container, blob, options);

// Assert
assertNotNull(getBlobResult);
BlobProperties blobProperties = getBlobResult.getProperties();
String actualMd5 = blobProperties.getContentMD5();
assertEquals(expectedMd5, actualMd5);

}

@Test
public void getBlobPropertiesWorks() throws Exception {
// Arrange
Expand Down

0 comments on commit 796a21a

Please sign in to comment.