@Test @Category({ DevFabricTests.class, DevStoreTests.class }) public void testFileGetRangeContentMD5Bounds() throws StorageException, IOException, URISyntaxException { { CloudFile file = FileTestHelper.uploadNewFile(this.share, 5 * Constants.MB, null); FileRequestOptions options = new FileRequestOptions(); OperationContext opContext = new OperationContext(); try { FileRequest.getFile(file.getUri(), options, opContext, null, null, 0L, 4L * Constants.MB, true); FileRequest.getFile(file.getUri(), options, opContext, null, null, 0L, 4L * Constants.MB + 1, true); fail("The request for range ContentMD5 should have thrown an Exception for exceeding the limit."); } catch (IllegalArgumentException e) { assertEquals(e.getMessage(), String.format("The value of the parameter 'count' should be between 1 and %1d.", Constants.MAX_BLOCK_SIZE)); } } }
@Override public HttpURLConnection buildRequest(CloudFileClient client, CloudFile file, OperationContext context) throws Exception { // The first time this is called, we have to set the length and offset. // On retries, these will already have values and need not be called. if (this.getOffset() == null) { this.setOffset(fileOffset); } if (this.getLength() == null) { this.setLength(length); } // Only do this when we have support from the service. // AccessCondition tempCondition = (this.getETagLockCondition() != null) ? this.getETagLockCondition() // : accessCondition; return FileRequest.getFile(file.getTransformedAddress(context).getUri(this.getCurrentLocation()), options, context, accessCondition, file.getShare().snapshotID, this.getOffset(), this.getLength(), (options.getUseTransactionalContentMD5() && !this.getArePropertiesPopulated())); }
@Override public HttpURLConnection buildRequest(CloudFileClient client, CloudFile file, OperationContext context) throws Exception { // The first time this is called, we have to set the length and offset. // On retries, these will already have values and need not be called. if (this.getOffset() == null) { this.setOffset(fileOffset); } if (this.getLength() == null) { this.setLength(length); } // Only do this when we have support from the service. // AccessCondition tempCondition = (this.getETagLockCondition() != null) ? this.getETagLockCondition() // : accessCondition; return FileRequest.getFile(file.getTransformedAddress(context).getUri(this.getCurrentLocation()), options, context, accessCondition, file.getShare().snapshotID, this.getOffset(), this.getLength(), (options.getUseTransactionalContentMD5() && !this.getArePropertiesPopulated())); }