diff --git a/sdk/storage/azure-storage-blob/CHANGELOG.md b/sdk/storage/azure-storage-blob/CHANGELOG.md index 0f0cfc08654e..04b4e22f69a1 100644 --- a/sdk/storage/azure-storage-blob/CHANGELOG.md +++ b/sdk/storage/azure-storage-blob/CHANGELOG.md @@ -2,6 +2,7 @@ ## 12.2.0-beta.2 (Unreleased) - Added a field to ParallelTransferOptions that allows customers to configure the maximum size to upload in a single PUT. Data sizes larger than this value will be chunked and parallelized. +- Added overloads to downloadToFile to add the option to overwrite existing files. Default behavior is to not overwrite. ## 12.2.0-beta.1 (2019-12-17) - Added SAS generation methods on clients to improve discoverability and convenience of sas. Deprecated setContainerName, setBlobName, setSnapshotId, generateSasQueryParameters methods on BlobServiceSasSignatureValues to direct users to using the methods added on clients. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java index 70dcdddd4621..2e2660d4c149 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java @@ -65,11 +65,14 @@ import java.nio.channels.AsynchronousFileChannel; import java.nio.file.FileAlreadyExistsException; import java.nio.file.Files; +import java.nio.file.OpenOption; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.time.Duration; import java.time.OffsetDateTime; +import java.util.HashSet; import java.util.Map; +import java.util.Set; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; @@ -680,8 +683,42 @@ private Mono downloadHelper(BlobRange range, DownloadRetryOpti * @return A reactive response containing the blob properties and metadata. */ public Mono downloadToFile(String filePath) { + return downloadToFile(filePath, false); + } + + /** + * Downloads the entire blob into a file specified by the path. + * + *

If overwrite is set to false, the file will be created and must not exist, if the file already exists a + * {@link FileAlreadyExistsException} will be thrown.

+ * + *

Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link + * AppendBlobClient}.

+ * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.downloadToFile#String-boolean} + * + *

For more information, see the + * Azure Docs

+ * + * @param filePath A non-null {@link OutputStream} instance where the downloaded data will be written. + * @param overwrite Whether or not to overwrite the file, should the file exist. + * @return A reactive response containing the blob properties and metadata. + */ + public Mono downloadToFile(String filePath, boolean overwrite) { try { - return downloadToFileWithResponse(filePath, null, null, null, null, false).flatMap(FluxUtil::toMono); + Set openOptions = null; + if (overwrite) { + openOptions = new HashSet<>(); + openOptions.add(StandardOpenOption.CREATE); + openOptions.add(StandardOpenOption.TRUNCATE_EXISTING); // If the file already exists and it is opened + // for WRITE access, then its length is truncated to 0. + openOptions.add(StandardOpenOption.READ); + openOptions.add(StandardOpenOption.WRITE); + } + return downloadToFileWithResponse(filePath, null, null, null, null, false, openOptions) + .flatMap(FluxUtil::toMono); } catch (RuntimeException ex) { return monoError(logger, ex); } @@ -720,9 +757,48 @@ public Mono downloadToFile(String filePath) { public Mono> downloadToFileWithResponse(String filePath, BlobRange range, ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions options, BlobRequestConditions requestConditions, boolean rangeGetContentMd5) { + return downloadToFileWithResponse(filePath, range, parallelTransferOptions, options, requestConditions, + rangeGetContentMd5, null); + } + + /** + * Downloads the entire blob into a file specified by the path. + * + *

By default the file will be created and must not exist, if the file already exists a + * {@link FileAlreadyExistsException} will be thrown. To override this behavior, provide appropriate + * {@link OpenOption OpenOptions}

+ * + *

Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link + * AppendBlobClient}.

+ * + *

This method makes an extra HTTP call to get the length of the blob in the beginning. To avoid this extra + * call, provide the {@link BlobRange} parameter.

+ * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.downloadToFileWithResponse#String-BlobRange-ParallelTransferOptions-DownloadRetryOptions-BlobRequestConditions-boolean-Set} + * + *

For more information, see the + * Azure Docs

+ * + * @param filePath A non-null {@link OutputStream} instance where the downloaded data will be written. + * @param range {@link BlobRange} + * @param parallelTransferOptions {@link ParallelTransferOptions} to use to download to file. Number of parallel + * transfers parameter is ignored. + * @param options {@link DownloadRetryOptions} + * @param requestConditions {@link BlobRequestConditions} + * @param rangeGetContentMd5 Whether the contentMD5 for the specified blob range should be returned. + * @param openOptions {@link OpenOption OpenOptions} to use to configure how to open or create the file. + * @return A reactive response containing the blob properties and metadata. + * @throws IllegalArgumentException If {@code blockSize} is less than 0 or greater than 100MB. + * @throws UncheckedIOException If an I/O error occurs. + */ + public Mono> downloadToFileWithResponse(String filePath, BlobRange range, + ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions options, + BlobRequestConditions requestConditions, boolean rangeGetContentMd5, Set openOptions) { try { return withContext(context -> downloadToFileWithResponse(filePath, range, parallelTransferOptions, options, - requestConditions, rangeGetContentMd5, context)); + requestConditions, rangeGetContentMd5, openOptions, context)); } catch (RuntimeException ex) { return monoError(logger, ex); } @@ -730,24 +806,32 @@ public Mono> downloadToFileWithResponse(String filePath Mono> downloadToFileWithResponse(String filePath, BlobRange range, ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions downloadRetryOptions, - BlobRequestConditions requestConditions, boolean rangeGetContentMd5, Context context) { + BlobRequestConditions requestConditions, boolean rangeGetContentMd5, Set openOptions, + Context context) { BlobRange finalRange = range == null ? new BlobRange(0) : range; final ParallelTransferOptions finalParallelTransferOptions = ModelHelper.populateAndApplyDefaults(parallelTransferOptions); BlobRequestConditions finalConditions = requestConditions == null ? new BlobRequestConditions() : requestConditions; - AsynchronousFileChannel channel = downloadToFileResourceSupplier(filePath); + // Default behavior is not to overwrite + if (openOptions == null) { + openOptions = new HashSet<>(); + openOptions.add(StandardOpenOption.CREATE_NEW); + openOptions.add(StandardOpenOption.WRITE); + openOptions.add(StandardOpenOption.READ); + } + + AsynchronousFileChannel channel = downloadToFileResourceSupplier(filePath, openOptions); return Mono.just(channel) .flatMap(c -> this.downloadToFileImpl(c, finalRange, finalParallelTransferOptions, downloadRetryOptions, finalConditions, rangeGetContentMd5, context)) .doFinally(signalType -> this.downloadToFileCleanup(channel, filePath, signalType)); } - private AsynchronousFileChannel downloadToFileResourceSupplier(String filePath) { + private AsynchronousFileChannel downloadToFileResourceSupplier(String filePath, Set openOptions) { try { - return AsynchronousFileChannel.open(Paths.get(filePath), StandardOpenOption.READ, StandardOpenOption.WRITE, - StandardOpenOption.CREATE_NEW); + return AsynchronousFileChannel.open(Paths.get(filePath), openOptions, null); } catch (IOException e) { throw logger.logExceptionAsError(new UncheckedIOException(e)); } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobClientBase.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobClientBase.java index bc0df9fcc0c1..3944bf78c38c 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobClientBase.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobClientBase.java @@ -40,9 +40,13 @@ import java.io.UncheckedIOException; import java.net.URL; import java.nio.file.FileAlreadyExistsException; +import java.nio.file.OpenOption; +import java.nio.file.StandardOpenOption; import java.time.Duration; import java.time.OffsetDateTime; +import java.util.HashSet; import java.util.Map; +import java.util.Set; import static com.azure.storage.common.implementation.StorageImplUtils.blockWithOptionalTimeout; @@ -444,7 +448,42 @@ public BlobDownloadResponse downloadWithResponse(OutputStream stream, BlobRange * @throws UncheckedIOException If an I/O error occurs */ public BlobProperties downloadToFile(String filePath) { - return downloadToFileWithResponse(filePath, null, null, null, null, false, null, Context.NONE).getValue(); + return downloadToFile(filePath, false); + } + + /** + * Downloads the entire blob into a file specified by the path. + * + *

If overwrite is set to false, the file will be created and must not exist, if the file already exists a + * {@link FileAlreadyExistsException} will be thrown.

+ * + *

Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link + * AppendBlobClient}.

+ * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.downloadToFile#String-boolean} + * + *

For more information, see the + * Azure Docs

+ * + * @param filePath A non-null {@link OutputStream} instance where the downloaded data will be written. + * @param overwrite Whether or not to overwrite the file, should the file exist. + * @return The blob properties and metadata. + * @throws UncheckedIOException If an I/O error occurs + */ + public BlobProperties downloadToFile(String filePath, boolean overwrite) { + Set openOptions = null; + if (overwrite) { + openOptions = new HashSet<>(); + openOptions.add(StandardOpenOption.CREATE); + openOptions.add(StandardOpenOption.TRUNCATE_EXISTING); // If the file already exists and it is opened + // for WRITE access, then its length is truncated to 0. + openOptions.add(StandardOpenOption.READ); + openOptions.add(StandardOpenOption.WRITE); + } + return downloadToFileWithResponse(filePath, null, null, null, null, false, openOptions, null, Context.NONE) + .getValue(); } /** @@ -481,8 +520,49 @@ public BlobProperties downloadToFile(String filePath) { public Response downloadToFileWithResponse(String filePath, BlobRange range, ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions downloadRetryOptions, BlobRequestConditions requestConditions, boolean rangeGetContentMd5, Duration timeout, Context context) { + return downloadToFileWithResponse(filePath, range, parallelTransferOptions, downloadRetryOptions, + requestConditions, rangeGetContentMd5, null, timeout, context); + } + + /** + * Downloads the entire blob into a file specified by the path. + * + *

By default the file will be created and must not exist, if the file already exists a + * {@link FileAlreadyExistsException} will be thrown. To override this behavior, provide appropriate + * {@link OpenOption OpenOptions}

+ * + *

Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link + * AppendBlobClient}.

+ * + *

This method makes an extra HTTP call to get the length of the blob in the beginning. To avoid this extra + * call, provide the {@link BlobRange} parameter.

+ * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.downloadToFileWithResponse#String-BlobRange-ParallelTransferOptions-DownloadRetryOptions-BlobRequestConditions-boolean-Set-Duration-Context} + * + *

For more information, see the + * Azure Docs

+ * + * @param filePath A non-null {@link OutputStream} instance where the downloaded data will be written. + * @param range {@link BlobRange} + * @param parallelTransferOptions {@link ParallelTransferOptions} to use to download to file. Number of parallel + * transfers parameter is ignored. + * @param downloadRetryOptions {@link DownloadRetryOptions} + * @param requestConditions {@link BlobRequestConditions} + * @param rangeGetContentMd5 Whether the contentMD5 for the specified blob range should be returned. + * @param openOptions {@link OpenOption OpenOptions} to use to configure how to open or create the file. + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the blob properties and metadata. + * @throws UncheckedIOException If an I/O error occurs. + */ + public Response downloadToFileWithResponse(String filePath, BlobRange range, + ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions downloadRetryOptions, + BlobRequestConditions requestConditions, boolean rangeGetContentMd5, Set openOptions, + Duration timeout, Context context) { Mono> download = client.downloadToFileWithResponse(filePath, range, - parallelTransferOptions, downloadRetryOptions, requestConditions, rangeGetContentMd5, context); + parallelTransferOptions, downloadRetryOptions, requestConditions, rangeGetContentMd5, openOptions, context); return blockWithOptionalTimeout(download, timeout); } diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobAsyncClientBaseJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobAsyncClientBaseJavaDocCodeSnippets.java index 9058b8e3cb8a..305d39dcd087 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobAsyncClientBaseJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobAsyncClientBaseJavaDocCodeSnippets.java @@ -24,10 +24,15 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.UncheckedIOException; +import java.nio.file.OpenOption; +import java.nio.file.StandardOpenOption; import java.time.Duration; import java.time.OffsetDateTime; +import java.util.Arrays; import java.util.Collections; +import java.util.HashSet; import java.util.Map; +import java.util.Set; /** * Code snippets for {@link BlobAsyncClientBase} @@ -130,14 +135,28 @@ public void downloadToFileCodeSnippet() { client.downloadToFile(file).subscribe(response -> System.out.println("Completed download to file")); // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.downloadToFile#String - // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.downloadToFileWithResponse#String-BlobRange-ParallelTransferOptions-DownloadRetryOptions-BlobRequestConditions-boolean + // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.downloadToFile#String-boolean + boolean overwrite = false; // Default value + client.downloadToFile(file, overwrite).subscribe(response -> System.out.println("Completed download to file")); + // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.downloadToFile#String-boolean + // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.downloadToFileWithResponse#String-BlobRange-ParallelTransferOptions-DownloadRetryOptions-BlobRequestConditions-boolean BlobRange range = new BlobRange(1024, 2048L); DownloadRetryOptions options = new DownloadRetryOptions().setMaxRetryRequests(5); client.downloadToFileWithResponse(file, range, null, options, null, false) .subscribe(response -> System.out.println("Completed download to file")); // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.downloadToFileWithResponse#String-BlobRange-ParallelTransferOptions-DownloadRetryOptions-BlobRequestConditions-boolean + + // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.downloadToFileWithResponse#String-BlobRange-ParallelTransferOptions-DownloadRetryOptions-BlobRequestConditions-boolean-Set + BlobRange blobRange = new BlobRange(1024, 2048L); + DownloadRetryOptions downloadRetryOptions = new DownloadRetryOptions().setMaxRetryRequests(5); + Set openOptions = new HashSet<>(Arrays.asList(StandardOpenOption.CREATE_NEW, + StandardOpenOption.WRITE, StandardOpenOption.READ)); // Default options + + client.downloadToFileWithResponse(file, blobRange, null, downloadRetryOptions, null, false, openOptions) + .subscribe(response -> System.out.println("Completed download to file")); + // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.downloadToFileWithResponse#String-BlobRange-ParallelTransferOptions-DownloadRetryOptions-BlobRequestConditions-boolean-Set } /** diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobClientBaseJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobClientBaseJavaDocCodeSnippets.java index 2cd4e3c850d8..c1000abd32d4 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobClientBaseJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobClientBaseJavaDocCodeSnippets.java @@ -28,10 +28,15 @@ import java.io.ByteArrayOutputStream; import java.io.OutputStream; import java.io.UncheckedIOException; +import java.nio.file.OpenOption; +import java.nio.file.StandardOpenOption; import java.time.Duration; import java.time.OffsetDateTime; +import java.util.Arrays; import java.util.Collections; +import java.util.HashSet; import java.util.Map; +import java.util.Set; /** * Code snippets for {@link BlobClientBase} @@ -110,6 +115,12 @@ public void downloadToFile() { System.out.println("Completed download to file"); // END: com.azure.storage.blob.specialized.BlobClientBase.downloadToFile#String + // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.downloadToFile#String-boolean + boolean overwrite = false; // Default value + client.downloadToFile(file, overwrite); + System.out.println("Completed download to file"); + // END: com.azure.storage.blob.specialized.BlobClientBase.downloadToFile#String-boolean + // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.downloadToFileWithResponse#String-BlobRange-ParallelTransferOptions-DownloadRetryOptions-BlobRequestConditions-boolean-Duration-Context BlobRange range = new BlobRange(1024, 2048L); DownloadRetryOptions options = new DownloadRetryOptions().setMaxRetryRequests(5); @@ -118,6 +129,17 @@ public void downloadToFile() { options, null, false, timeout, new Context(key2, value2)); System.out.println("Completed download to file"); // END: com.azure.storage.blob.specialized.BlobClientBase.downloadToFileWithResponse#String-BlobRange-ParallelTransferOptions-DownloadRetryOptions-BlobRequestConditions-boolean-Duration-Context + + // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.downloadToFileWithResponse#String-BlobRange-ParallelTransferOptions-DownloadRetryOptions-BlobRequestConditions-boolean-Set-Duration-Context + BlobRange blobRange = new BlobRange(1024, 2048L); + DownloadRetryOptions downloadRetryOptions = new DownloadRetryOptions().setMaxRetryRequests(5); + Set openOptions = new HashSet<>(Arrays.asList(StandardOpenOption.CREATE_NEW, + StandardOpenOption.WRITE, StandardOpenOption.READ)); // Default options + + client.downloadToFileWithResponse(file, blobRange, new ParallelTransferOptions(4 * Constants.MB, null, null), + downloadRetryOptions, null, false, openOptions, timeout, new Context(key2, value2)); + System.out.println("Completed download to file"); + // END: com.azure.storage.blob.specialized.BlobClientBase.downloadToFileWithResponse#String-BlobRange-ParallelTransferOptions-DownloadRetryOptions-BlobRequestConditions-boolean-Set-Duration-Context } /** diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy index 5628bb0fef5f..7a59ec06d6cf 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy @@ -36,9 +36,12 @@ import spock.lang.Requires import spock.lang.Unroll import java.nio.ByteBuffer +import java.nio.channels.NonWritableChannelException import java.nio.charset.StandardCharsets import java.nio.file.FileAlreadyExistsException import java.nio.file.Files +import java.nio.file.OpenOption +import java.nio.file.StandardOpenOption import java.security.MessageDigest import java.time.Duration import java.time.OffsetDateTime @@ -263,6 +266,7 @@ class BlobAPITest extends APISpec { } when: + // Default overwrite is false so this should fail bc.downloadToFile(testFile.getPath()) then: @@ -273,6 +277,23 @@ class BlobAPITest extends APISpec { testFile.delete() } + def "Download to file exists succeeds"() { + setup: + def testFile = new File(testName + ".txt") + if (!testFile.exists()) { + assert testFile.createNewFile() + } + + when: + bc.downloadToFile(testFile.getPath(), true) + + then: + new String(Files.readAllBytes(testFile.toPath()), StandardCharsets.UTF_8) == defaultText + + cleanup: + testFile.delete() + } + def "Download to file does not exist"() { setup: def testFile = new File(testName + ".txt") @@ -290,6 +311,49 @@ class BlobAPITest extends APISpec { testFile.delete() } + def "Download file does not exist open options"() { + setup: + def testFile = new File(testName + ".txt") + if (testFile.exists()) { + assert testFile.delete() + } + + when: + Set openOptions = new HashSet<>() + openOptions.add(StandardOpenOption.CREATE_NEW) + openOptions.add(StandardOpenOption.READ) + openOptions.add(StandardOpenOption.WRITE) + bc.downloadToFileWithResponse(testFile.getPath(), null, null, null, null, false, openOptions, null, null) + + then: + new String(Files.readAllBytes(testFile.toPath()), StandardCharsets.UTF_8) == defaultText + + cleanup: + testFile.delete() + } + + def "Download file exist open options"() { + setup: + def testFile = new File(testName + ".txt") + if (!testFile.exists()) { + assert testFile.createNewFile() + } + + when: + Set openOptions = new HashSet<>() + openOptions.add(StandardOpenOption.CREATE) + openOptions.add(StandardOpenOption.TRUNCATE_EXISTING) + openOptions.add(StandardOpenOption.READ) + openOptions.add(StandardOpenOption.WRITE) + bc.downloadToFileWithResponse(testFile.getPath(), null, null, null, null, false, openOptions, null, null) + + then: + new String(Files.readAllBytes(testFile.toPath()), StandardCharsets.UTF_8) == defaultText + + cleanup: + testFile.delete() + } + @Requires({ liveMode() }) @Unroll def "Download file"() { diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadfiledoesnotexistopenoptions.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadfiledoesnotexistopenoptions.json new file mode 100644 index 000000000000..b9a809806b7e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadfiledoesnotexistopenoptions.json @@ -0,0 +1,121 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadfiledoesnotexistopenoptions02899367a6b4e79?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "250e22c7-c995-4ddf-a3ba-efc27723e0f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D785A6954049C0", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c72e9cc0-001e-0016-5c8f-b764ec000000", + "Date" : "Fri, 20 Dec 2019 23:44:40 GMT", + "x-ms-client-request-id" : "250e22c7-c995-4ddf-a3ba-efc27723e0f2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadfiledoesnotexistopenoptions02899367a6b4e79/javablobdownloadfiledoesnotexistopenoptions11894382a29b9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "4e421bd1-c9a7-4359-a195-9c1d556fe5f5", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 20 Dec 2019 23:44:40 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D785A6955FA3AD", + "Content-Length" : "0", + "x-ms-request-id" : "c72e9cd5-001e-0016-6f8f-b764ec000000", + "x-ms-client-request-id" : "4e421bd1-c9a7-4359-a195-9c1d556fe5f5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadfiledoesnotexistopenoptions02899367a6b4e79/javablobdownloadfiledoesnotexistopenoptions11894382a29b9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "d8a96f02-a74d-4be4-842e-0541803e9471" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Content-Range" : "bytes 0-6/7", + "x-ms-lease-state" : "available", + "x-ms-blob-content-md5" : "wh+Wm18D0z1D4E+PE252gg==", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:41 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Fri, 20 Dec 2019 23:44:40 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "0x8D785A6955FA3AD", + "x-ms-creation-time" : "Fri, 20 Dec 2019 23:44:41 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c72e9cde-001e-0016-788f-b764ec000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "d8a96f02-a74d-4be4-842e-0541803e9471", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gaprastg71.blob.core.windows.net?prefix=jtcdownloadfiledoesnotexistopenoptions&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "52ddb186-fb70-4870-9c86-2df33ed1990b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c72e9cf4-001e-0016-0e8f-b764ec000000", + "Body" : "jtcdownloadfiledoesnotexistopenoptionsjtcdownloadfiledoesnotexistopenoptions02899367a6b4e79Fri, 20 Dec 2019 23:44:41 GMT\"0x8D785A6954049C0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 20 Dec 2019 23:44:40 GMT", + "x-ms-client-request-id" : "52ddb186-fb70-4870-9c86-2df33ed1990b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadfiledoesnotexistopenoptions02899367a6b4e79?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "9adcbc59-e868-492e-b48b-91122018b2db" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c72e9d09-001e-0016-228f-b764ec000000", + "Date" : "Fri, 20 Dec 2019 23:44:40 GMT", + "x-ms-client-request-id" : "9adcbc59-e868-492e-b48b-91122018b2db" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadfiledoesnotexistopenoptions02899367a6b4e79", "javablobdownloadfiledoesnotexistopenoptions11894382a29b9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadfileexistopenoptions.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadfileexistopenoptions.json new file mode 100644 index 000000000000..85d7435f6a09 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadfileexistopenoptions.json @@ -0,0 +1,121 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadfileexistopenoptions04880095a4282c15bc4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "7bbc621e-d546-4595-8e6e-d2f2d251bd3d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D785A698DA9CBA", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d4138152-b01e-003c-1f8f-b7bbfc000000", + "Date" : "Fri, 20 Dec 2019 23:44:46 GMT", + "x-ms-client-request-id" : "7bbc621e-d546-4595-8e6e-d2f2d251bd3d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadfileexistopenoptions04880095a4282c15bc4/javablobdownloadfileexistopenoptions165910938502956c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "c81853c1-60ed-4d0f-92dc-82da3705a1ef", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 20 Dec 2019 23:44:46 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D785A698FAF169", + "Content-Length" : "0", + "x-ms-request-id" : "d413816e-b01e-003c-388f-b7bbfc000000", + "x-ms-client-request-id" : "c81853c1-60ed-4d0f-92dc-82da3705a1ef" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadfileexistopenoptions04880095a4282c15bc4/javablobdownloadfileexistopenoptions165910938502956c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "d44d712c-f3c7-4080-8757-e4c4519261df" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Content-Range" : "bytes 0-6/7", + "x-ms-lease-state" : "available", + "x-ms-blob-content-md5" : "wh+Wm18D0z1D4E+PE252gg==", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:47 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Fri, 20 Dec 2019 23:44:46 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "0x8D785A698FAF169", + "x-ms-creation-time" : "Fri, 20 Dec 2019 23:44:47 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d413817a-b01e-003c-448f-b7bbfc000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "d44d712c-f3c7-4080-8757-e4c4519261df", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gaprastg71.blob.core.windows.net?prefix=jtcdownloadfileexistopenoptions&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "2174cd50-6809-460c-918e-baa431f8d1f1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d4138188-b01e-003c-518f-b7bbfc000000", + "Body" : "jtcdownloadfileexistopenoptionsjtcdownloadfileexistopenoptions04880095a4282c15bc4Fri, 20 Dec 2019 23:44:47 GMT\"0x8D785A698DA9CBA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 20 Dec 2019 23:44:47 GMT", + "x-ms-client-request-id" : "2174cd50-6809-460c-918e-baa431f8d1f1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadfileexistopenoptions04880095a4282c15bc4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "c7b8cec4-d64b-41bd-9886-39d9e41f9c95" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d4138193-b01e-003c-5c8f-b7bbfc000000", + "Date" : "Fri, 20 Dec 2019 23:44:47 GMT", + "x-ms-client-request-id" : "c7b8cec4-d64b-41bd-9886-39d9e41f9c95" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadfileexistopenoptions04880095a4282c15bc4", "javablobdownloadfileexistopenoptions165910938502956c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofiledoesnotexist.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofiledoesnotexist.json index d77e531edd6e..106bd912697f 100644 --- a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofiledoesnotexist.json +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofiledoesnotexist.json @@ -1,88 +1,57 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadtofiledoesnotexist0128346b089568604141?restype=container", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadtofiledoesnotexist0024275cbd3672129344?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 1.8.0_221; Mac OS X 10.14.6", - "x-ms-client-request-id" : "d5278936-f352-4300-9879-c3f6e7831de7" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "2c602f4e-2286-4c53-a71b-5c1bb4e85418" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75A7E30E8ADFB", - "Last-Modified" : "Sun, 27 Oct 2019 01:37:12 GMT", + "ETag" : "0x8D785A68D2E8A64", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:27 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "161e6599-301e-013a-3a67-8c3580000000", - "Date" : "Sun, 27 Oct 2019 01:37:12 GMT", - "x-ms-client-request-id" : "d5278936-f352-4300-9879-c3f6e7831de7" + "x-ms-request-id" : "135ab365-501e-001b-3e8f-b7ac38000000", + "Date" : "Fri, 20 Dec 2019 23:44:26 GMT", + "x-ms-client-request-id" : "2c602f4e-2286-4c53-a71b-5c1bb4e85418" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadtofiledoesnotexist0128346b089568604141/javablobdownloadtofiledoesnotexist191575f30f3eaddd5", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadtofiledoesnotexist0024275cbd3672129344/javablobdownloadtofiledoesnotexist1944333aaba2cac77", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 1.8.0_221; Mac OS X 10.14.6", - "x-ms-client-request-id" : "e82ecd76-97a6-4dd5-a4c8-3fb987d693ca", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "f211c0b3-732f-49ee-bb03-2bec04acf497", "Content-Type" : "application/octet-stream" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "x-ms-content-crc64" : "6RYQPwaVsyQ=", - "Last-Modified" : "Sun, 27 Oct 2019 01:37:12 GMT", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:27 GMT", "retry-after" : "0", "StatusCode" : "201", "x-ms-request-server-encrypted" : "true", - "Date" : "Sun, 27 Oct 2019 01:37:12 GMT", + "Date" : "Fri, 20 Dec 2019 23:44:26 GMT", "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", - "ETag" : "0x8D75A7E30F07167", + "ETag" : "0x8D785A68D4EF9AC", "Content-Length" : "0", - "x-ms-request-id" : "161e65a1-301e-013a-4167-8c3580000000", - "x-ms-client-request-id" : "e82ecd76-97a6-4dd5-a4c8-3fb987d693ca" - }, - "Exception" : null - }, { - "Method" : "HEAD", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadtofiledoesnotexist0128346b089568604141/javablobdownloadtofiledoesnotexist191575f30f3eaddd5", - "Headers" : { - "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 1.8.0_221; Mac OS X 10.14.6", - "x-ms-client-request-id" : "c27b5db0-fc65-4c2a-9c6e-556c5dc21573" - }, - "Response" : { - "x-ms-version" : "2019-02-02", - "x-ms-lease-status" : "unlocked", - "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-lease-state" : "available", - "Last-Modified" : "Sun, 27 Oct 2019 01:37:12 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Sun, 27 Oct 2019 01:37:12 GMT", - "x-ms-blob-type" : "BlockBlob", - "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", - "Accept-Ranges" : "bytes", - "x-ms-server-encrypted" : "true", - "x-ms-access-tier-inferred" : "true", - "x-ms-access-tier" : "Hot", - "ETag" : "0x8D75A7E30F07167", - "x-ms-creation-time" : "Sun, 27 Oct 2019 01:37:12 GMT", - "Content-Length" : "7", - "x-ms-request-id" : "161e65b4-301e-013a-4c67-8c3580000000", - "x-ms-client-request-id" : "c27b5db0-fc65-4c2a-9c6e-556c5dc21573", - "Content-Type" : "application/octet-stream" + "x-ms-request-id" : "135ab371-501e-001b-478f-b7ac38000000", + "x-ms-client-request-id" : "f211c0b3-732f-49ee-bb03-2bec04acf497" }, "Exception" : null }, { "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadtofiledoesnotexist0128346b089568604141/javablobdownloadtofiledoesnotexist191575f30f3eaddd5", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadtofiledoesnotexist0024275cbd3672129344/javablobdownloadtofiledoesnotexist1944333aaba2cac77", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 1.8.0_221; Mac OS X 10.14.6", - "x-ms-client-request-id" : "17b03287-090c-498f-9917-6d683fca860b" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "81e0f400-6d7e-4628-a241-8c2e0fb89e24" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -91,29 +60,29 @@ "Content-Range" : "bytes 0-6/7", "x-ms-lease-state" : "available", "x-ms-blob-content-md5" : "wh+Wm18D0z1D4E+PE252gg==", - "Last-Modified" : "Sun, 27 Oct 2019 01:37:12 GMT", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:27 GMT", "retry-after" : "0", "StatusCode" : "206", - "Date" : "Sun, 27 Oct 2019 01:37:13 GMT", + "Date" : "Fri, 20 Dec 2019 23:44:26 GMT", "x-ms-blob-type" : "BlockBlob", "Accept-Ranges" : "bytes", "x-ms-server-encrypted" : "true", - "ETag" : "0x8D75A7E30F07167", - "x-ms-creation-time" : "Sun, 27 Oct 2019 01:37:12 GMT", + "ETag" : "0x8D785A68D4EF9AC", + "x-ms-creation-time" : "Fri, 20 Dec 2019 23:44:27 GMT", "Content-Length" : "7", - "x-ms-request-id" : "161e65c0-301e-013a-5767-8c3580000000", + "x-ms-request-id" : "135ab378-501e-001b-4e8f-b7ac38000000", "Body" : "[100, 101, 102, 97, 117, 108, 116]", - "x-ms-client-request-id" : "17b03287-090c-498f-9917-6d683fca860b", + "x-ms-client-request-id" : "81e0f400-6d7e-4628-a241-8c2e0fb89e24", "Content-Type" : "application/octet-stream" }, "Exception" : null }, { "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdownloadtofiledoesnotexist&comp=list", + "Uri" : "https://gaprastg71.blob.core.windows.net?prefix=jtcdownloadtofiledoesnotexist&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 1.8.0_221; Mac OS X 10.14.6", - "x-ms-client-request-id" : "6a0bdeb4-e335-44ce-b68f-a1945400381a" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "866138f8-a63b-4566-8128-b10096fa9674" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -121,20 +90,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "161e65d8-301e-013a-6967-8c3580000000", - "Body" : "jtcdownloadtofiledoesnotexistjtcdownloadtofiledoesnotexist0128346b089568604141Sun, 27 Oct 2019 01:37:12 GMT\"0x8D75A7E30E8ADFB\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Sun, 27 Oct 2019 01:37:13 GMT", - "x-ms-client-request-id" : "6a0bdeb4-e335-44ce-b68f-a1945400381a", + "x-ms-request-id" : "135ab37b-501e-001b-518f-b7ac38000000", + "Body" : "jtcdownloadtofiledoesnotexistjtcdownloadtofiledoesnotexist0024275cbd3672129344Fri, 20 Dec 2019 23:44:27 GMT\"0x8D785A68D2E8A64\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 20 Dec 2019 23:44:27 GMT", + "x-ms-client-request-id" : "866138f8-a63b-4566-8128-b10096fa9674", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadtofiledoesnotexist0128346b089568604141?restype=container", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadtofiledoesnotexist0024275cbd3672129344?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 1.8.0_221; Mac OS X 10.14.6", - "x-ms-client-request-id" : "665eb1d1-1bb8-4c21-90a6-1948707af336" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "c3e54cd1-64ec-47dd-b028-872c88a8a515" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -142,11 +111,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "161e65e3-301e-013a-7267-8c3580000000", - "Date" : "Sun, 27 Oct 2019 01:37:13 GMT", - "x-ms-client-request-id" : "665eb1d1-1bb8-4c21-90a6-1948707af336" + "x-ms-request-id" : "135ab382-501e-001b-588f-b7ac38000000", + "Date" : "Fri, 20 Dec 2019 23:44:27 GMT", + "x-ms-client-request-id" : "c3e54cd1-64ec-47dd-b028-872c88a8a515" }, "Exception" : null } ], - "variables" : [ "jtcdownloadtofiledoesnotexist0128346b089568604141", "javablobdownloadtofiledoesnotexist191575f30f3eaddd5" ] + "variables" : [ "jtcdownloadtofiledoesnotexist0024275cbd3672129344", "javablobdownloadtofiledoesnotexist1944333aaba2cac77" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofileexists.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofileexists.json index e7c5e5baca0b..4f658045b66a 100644 --- a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofileexists.json +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofileexists.json @@ -1,57 +1,57 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadtofileexists0298267b4b3ff5b0d344fb9?restype=container", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadtofileexists096284cd349d96e6894615b?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 1.8.0_221; Mac OS X 10.14.6", - "x-ms-client-request-id" : "9e84f432-dfb5-401b-a789-95227683f273" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "877308ef-878c-4e5f-8297-c340f9b6f12b" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75A7E30C650A7", - "Last-Modified" : "Sun, 27 Oct 2019 01:37:12 GMT", + "ETag" : "0x8D785A6859A6889", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:14 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "161e6566-301e-013a-0f67-8c3580000000", - "Date" : "Sun, 27 Oct 2019 01:37:12 GMT", - "x-ms-client-request-id" : "9e84f432-dfb5-401b-a789-95227683f273" + "x-ms-request-id" : "3f3f5c68-501e-0024-5c8f-b7649b000000", + "Date" : "Fri, 20 Dec 2019 23:44:14 GMT", + "x-ms-client-request-id" : "877308ef-878c-4e5f-8297-c340f9b6f12b" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadtofileexists0298267b4b3ff5b0d344fb9/javablobdownloadtofileexists199775a51f46ceaa9c41", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadtofileexists096284cd349d96e6894615b/javablobdownloadtofileexists160998f87cd14a25c740", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 1.8.0_221; Mac OS X 10.14.6", - "x-ms-client-request-id" : "a63a0a6a-a5dc-4a9a-92c3-7d642d473a41", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "c6c2734a-34a2-4681-a3c2-95bceb1d7f12", "Content-Type" : "application/octet-stream" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "x-ms-content-crc64" : "6RYQPwaVsyQ=", - "Last-Modified" : "Sun, 27 Oct 2019 01:37:12 GMT", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:15 GMT", "retry-after" : "0", "StatusCode" : "201", "x-ms-request-server-encrypted" : "true", - "Date" : "Sun, 27 Oct 2019 01:37:12 GMT", + "Date" : "Fri, 20 Dec 2019 23:44:14 GMT", "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", - "ETag" : "0x8D75A7E30D05E86", + "ETag" : "0x8D785A685B95044", "Content-Length" : "0", - "x-ms-request-id" : "161e657c-301e-013a-2067-8c3580000000", - "x-ms-client-request-id" : "a63a0a6a-a5dc-4a9a-92c3-7d642d473a41" + "x-ms-request-id" : "3f3f5c7e-501e-0024-708f-b7649b000000", + "x-ms-client-request-id" : "c6c2734a-34a2-4681-a3c2-95bceb1d7f12" }, "Exception" : null }, { "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdownloadtofileexists&comp=list", + "Uri" : "https://gaprastg71.blob.core.windows.net?prefix=jtcdownloadtofileexists&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 1.8.0_221; Mac OS X 10.14.6", - "x-ms-client-request-id" : "ceb77eea-d2a7-4a31-a953-028e10262c3b" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "4da31a8e-7637-4c10-841e-03a576d0df6f" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -59,20 +59,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "161e6585-301e-013a-2867-8c3580000000", - "Body" : "jtcdownloadtofileexistsjtcdownloadtofileexists0298267b4b3ff5b0d344fb9Sun, 27 Oct 2019 01:37:12 GMT\"0x8D75A7E30C650A7\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Sun, 27 Oct 2019 01:37:12 GMT", - "x-ms-client-request-id" : "ceb77eea-d2a7-4a31-a953-028e10262c3b", + "x-ms-request-id" : "3f3f5c82-501e-0024-748f-b7649b000000", + "Body" : "jtcdownloadtofileexistsjtcdownloadtofileexists096284cd349d96e6894615bFri, 20 Dec 2019 23:44:14 GMT\"0x8D785A6859A6889\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 20 Dec 2019 23:44:15 GMT", + "x-ms-client-request-id" : "4da31a8e-7637-4c10-841e-03a576d0df6f", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadtofileexists0298267b4b3ff5b0d344fb9?restype=container", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadtofileexists096284cd349d96e6894615b?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.5 1.8.0_221; Mac OS X 10.14.6", - "x-ms-client-request-id" : "c7a43be8-e4e2-49bd-b327-a6901be20a9e" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "1060987e-9486-4e1b-b720-c0745ab8e47c" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -80,11 +80,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "161e6590-301e-013a-3367-8c3580000000", - "Date" : "Sun, 27 Oct 2019 01:37:12 GMT", - "x-ms-client-request-id" : "c7a43be8-e4e2-49bd-b327-a6901be20a9e" + "x-ms-request-id" : "3f3f5c87-501e-0024-788f-b7649b000000", + "Date" : "Fri, 20 Dec 2019 23:44:15 GMT", + "x-ms-client-request-id" : "1060987e-9486-4e1b-b720-c0745ab8e47c" }, "Exception" : null } ], - "variables" : [ "jtcdownloadtofileexists0298267b4b3ff5b0d344fb9", "javablobdownloadtofileexists199775a51f46ceaa9c41" ] + "variables" : [ "jtcdownloadtofileexists096284cd349d96e6894615b", "javablobdownloadtofileexists160998f87cd14a25c740" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofileexistssucceeds.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofileexistssucceeds.json new file mode 100644 index 000000000000..fc1e373ebb7c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofileexistssucceeds.json @@ -0,0 +1,121 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadtofileexistssucceeds087572dd477056d04a4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "dfdd82b9-c5a7-4197-8c2b-a47e0d12b206" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D785A689017FC1", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "bfd6dcfc-001e-0029-728f-b7ac4f000000", + "Date" : "Fri, 20 Dec 2019 23:44:20 GMT", + "x-ms-client-request-id" : "dfdd82b9-c5a7-4197-8c2b-a47e0d12b206" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadtofileexistssucceeds087572dd477056d04a4/javablobdownloadtofileexistssucceeds107956e96a6f95a8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "12ba715d-8099-46db-b600-bfad65edd707", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 20 Dec 2019 23:44:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D785A689237A1F", + "Content-Length" : "0", + "x-ms-request-id" : "bfd6dd03-001e-0029-778f-b7ac4f000000", + "x-ms-client-request-id" : "12ba715d-8099-46db-b600-bfad65edd707" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadtofileexistssucceeds087572dd477056d04a4/javablobdownloadtofileexistssucceeds107956e96a6f95a8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "e5410772-924f-4cbe-9e60-0a3038ac0219" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Content-Range" : "bytes 0-6/7", + "x-ms-lease-state" : "available", + "x-ms-blob-content-md5" : "wh+Wm18D0z1D4E+PE252gg==", + "Last-Modified" : "Fri, 20 Dec 2019 23:44:20 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Fri, 20 Dec 2019 23:44:20 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "0x8D785A689237A1F", + "x-ms-creation-time" : "Fri, 20 Dec 2019 23:44:20 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "bfd6dd0a-001e-0029-7e8f-b7ac4f000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "e5410772-924f-4cbe-9e60-0a3038ac0219", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gaprastg71.blob.core.windows.net?prefix=jtcdownloadtofileexistssucceeds&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "833f516e-de8c-4c85-b5d7-4a2cf61224af" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "bfd6dd13-001e-0029-078f-b7ac4f000000", + "Body" : "jtcdownloadtofileexistssucceedsjtcdownloadtofileexistssucceeds087572dd477056d04a4Fri, 20 Dec 2019 23:44:20 GMT\"0x8D785A689017FC1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 20 Dec 2019 23:44:20 GMT", + "x-ms-client-request-id" : "833f516e-de8c-4c85-b5d7-4a2cf61224af", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gaprastg71.blob.core.windows.net/jtcdownloadtofileexistssucceeds087572dd477056d04a4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.2 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "574fcc77-94cc-479d-8cb5-bc7a7b56731b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "bfd6dd16-001e-0029-0a8f-b7ac4f000000", + "Date" : "Fri, 20 Dec 2019 23:44:21 GMT", + "x-ms-client-request-id" : "574fcc77-94cc-479d-8cb5-bc7a7b56731b" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadtofileexistssucceeds087572dd477056d04a4", "javablobdownloadtofileexistssucceeds107956e96a6f95a8" ] +} \ No newline at end of file