/** * Creates an instance of the <code>FileRequestOptions</code> class by copying values from another * <code>FileRequestOptions</code> instance. * * @param other * A {@link FileRequestOptions} object which represents the file request options to copy. */ public FileRequestOptions(final FileRequestOptions other) { super(other); if (other != null) { this.setConcurrentRequestCount(other.getConcurrentRequestCount()); this.setDisableContentMD5Validation(other.getDisableContentMD5Validation()); this.setStoreFileContentMD5(other.getStoreFileContentMD5()); this.setUseTransactionalContentMD5(other.getUseTransactionalContentMD5()); } }
/** * Creates an instance of the <code>FileRequestOptions</code> class by copying values from another * <code>FileRequestOptions</code> instance. * * @param other * A {@link FileRequestOptions} object which represents the file request options to copy. */ public FileRequestOptions(final FileRequestOptions other) { super(other); if (other != null) { this.setConcurrentRequestCount(other.getConcurrentRequestCount()); this.setDisableContentMD5Validation(other.getDisableContentMD5Validation()); this.setStoreFileContentMD5(other.getStoreFileContentMD5()); this.setUseTransactionalContentMD5(other.getUseTransactionalContentMD5()); } }
/** * Applies defaults to the options passed in. * * @param modifiedOptions * The options to apply defaults to. */ protected static void applyDefaults(final FileRequestOptions modifiedOptions) { Utility.assertNotNull("modifiedOptions", modifiedOptions); RequestOptions.applyBaseDefaultsInternal(modifiedOptions); if (modifiedOptions.getConcurrentRequestCount() == null) { modifiedOptions.setConcurrentRequestCount(FileConstants.DEFAULT_CONCURRENT_REQUEST_COUNT); } if (modifiedOptions.getUseTransactionalContentMD5() == null) { modifiedOptions.setUseTransactionalContentMD5(false); } if (modifiedOptions.getStoreFileContentMD5() == null) { modifiedOptions.setStoreFileContentMD5(false); } if (modifiedOptions.getDisableContentMD5Validation() == null) { modifiedOptions.setDisableContentMD5Validation(false); } }
/** * Applies defaults to the options passed in. * * @param modifiedOptions * The options to apply defaults to. */ protected static void applyDefaults(final FileRequestOptions modifiedOptions) { Utility.assertNotNull("modifiedOptions", modifiedOptions); RequestOptions.applyBaseDefaultsInternal(modifiedOptions); if (modifiedOptions.getConcurrentRequestCount() == null) { modifiedOptions.setConcurrentRequestCount(FileConstants.DEFAULT_CONCURRENT_REQUEST_COUNT); } if (modifiedOptions.getUseTransactionalContentMD5() == null) { modifiedOptions.setUseTransactionalContentMD5(false); } if (modifiedOptions.getStoreFileContentMD5() == null) { modifiedOptions.setStoreFileContentMD5(false); } if (modifiedOptions.getDisableContentMD5Validation() == null) { modifiedOptions.setDisableContentMD5Validation(false); } }
@Test @Category({ DevFabricTests.class, DevStoreTests.class }) public void testVerifyTransactionalMD5ValidationMissingOverallMD5() throws URISyntaxException, StorageException, IOException { final String fileName = FileTestHelper.generateRandomFileName(); final CloudFile fileRef = this.share.getRootDirectoryReference().getFileReference(fileName); final int length = 3*1024; ByteArrayInputStream srcStream = BlobTestHelper.getRandomDataStream(length); FileRequestOptions options = new FileRequestOptions(); options.setDisableContentMD5Validation(true); options.setStoreFileContentMD5(false); fileRef.upload(srcStream, length, null, options, null); options.setDisableContentMD5Validation(false); options.setStoreFileContentMD5(true); options.setUseTransactionalContentMD5(true); final CloudFile fileRef2 = this.share.getRootDirectoryReference().getFileReference(fileName); fileRef2.downloadRange(1024, (long)1024, new ByteArrayOutputStream(), null, options, null); assertNull(fileRef2.getProperties().getContentMD5()); }