diff --git a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md index 0171f6c6ac98..8175f8b8e4cb 100644 --- a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md +++ b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md @@ -1,5 +1,8 @@ # Change Log azure-storage-file-datalake +## Version XXXX-X-X-beta.X (XXXX-XX-XX) +- Added support for exists method on FileClients and DirectoryClients + ## Version 12.0.0-beta.7 (2019-12-04) This package's [documentation](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/storage/azure-storage-file-datalake/README.md) diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakePathAsyncClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakePathAsyncClient.java index cf6b35526e04..170a668daac5 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakePathAsyncClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakePathAsyncClient.java @@ -419,6 +419,41 @@ public Mono> getPropertiesWithResponse(DataLakeRequestC } } + /** + * Determines if the path this client represents exists in the cloud. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.file.datalake.DataLakePathAsyncClient.exists} + * + * @return true if the path exists, false if it doesn't + */ + public Mono exists() { + try { + return existsWithResponse().flatMap(FluxUtil::toMono); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Determines if the path this client represents exists in the cloud. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.file.datalake.DataLakePathAsyncClient.existsWithResponse} + * + * @return true if the path exists, false if it doesn't + */ + public Mono> existsWithResponse() { + try { + // TODO (gapra) : Once datalake error mapping is merged, add onErrorMap + return blockBlobAsyncClient.existsWithResponse(); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + /** * Changes the access control list, group and/or owner for a resource. * diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakePathClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakePathClient.java index 29c1d6890053..1558b5df55dc 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakePathClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakePathClient.java @@ -405,6 +405,35 @@ public Response getPropertiesWithResponse(DataLakeRequestConditi return new SimpleResponse<>(response, Transforms.toPathProperties(response.getValue())); } + /** + * Gets if the path this client represents exists in the cloud. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.file.datalake.DataLakePathClient.exists} + * + * @return true if the path exists, false if it doesn't + */ + public Boolean exists() { + return existsWithResponse(null, Context.NONE).getValue(); + } + + /** + * Gets if the path this client represents exists in the cloud. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.file.datalake.DataLakePathClient.existsWithResponse#Duration-Context} + * + * @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 true if the path exists, false if it doesn't + */ + public Response existsWithResponse(Duration timeout, Context context) { + // TODO (gapra) : Once error mapping is merged add error mapping + return blockBlobClient.existsWithResponse(timeout, context); + } + /** * Package-private rename method for use by {@link DataLakeFileClient} and {@link DataLakeDirectoryClient} * diff --git a/sdk/storage/azure-storage-file-datalake/src/samples/java/com/azure/storage/file/datalake/PathAsyncClientJavaDocCodeSamples.java b/sdk/storage/azure-storage-file-datalake/src/samples/java/com/azure/storage/file/datalake/PathAsyncClientJavaDocCodeSamples.java index edc66aeefcdc..b8d89127f4cf 100644 --- a/sdk/storage/azure-storage-file-datalake/src/samples/java/com/azure/storage/file/datalake/PathAsyncClientJavaDocCodeSamples.java +++ b/sdk/storage/azure-storage-file-datalake/src/samples/java/com/azure/storage/file/datalake/PathAsyncClientJavaDocCodeSamples.java @@ -124,6 +124,24 @@ public void getPropertiesWithResponseCodeSnippets() { // END: com.azure.storage.file.datalake.DataLakePathAsyncClient.getPropertiesWithResponse#DataLakeRequestConditions } + /** + * Code snippet for {@link DataLakePathAsyncClient#exists()} + */ + public void existsCodeSnippet() { + // BEGIN: com.azure.storage.file.datalake.DataLakePathAsyncClient.exists + client.exists().subscribe(response -> System.out.printf("Exists? %b%n", response)); + // END: com.azure.storage.file.datalake.DataLakePathAsyncClient.exists + } + + /** + * Code snippet for {@link DataLakePathAsyncClient#existsWithResponse()} + */ + public void existsWithResponseCodeSnippet() { + // BEGIN: com.azure.storage.file.datalake.DataLakePathAsyncClient.existsWithResponse + client.existsWithResponse().subscribe(response -> System.out.printf("Exists? %b%n", response.getValue())); + // END: com.azure.storage.file.datalake.DataLakePathAsyncClient.existsWithResponse + } + /** * Code snippets for {@link DataLakePathAsyncClient#setAccessControlList(List, String, String)} */ diff --git a/sdk/storage/azure-storage-file-datalake/src/samples/java/com/azure/storage/file/datalake/PathClientJavaDocCodeSamples.java b/sdk/storage/azure-storage-file-datalake/src/samples/java/com/azure/storage/file/datalake/PathClientJavaDocCodeSamples.java index e81213c850fa..ffa4262566a2 100644 --- a/sdk/storage/azure-storage-file-datalake/src/samples/java/com/azure/storage/file/datalake/PathClientJavaDocCodeSamples.java +++ b/sdk/storage/azure-storage-file-datalake/src/samples/java/com/azure/storage/file/datalake/PathClientJavaDocCodeSamples.java @@ -139,6 +139,24 @@ public void getPropertiesWithResponseCodeSnippets() { // END: com.azure.storage.file.datalake.DataLakePathClient.getPropertiesWithResponse#DataLakeRequestConditions-Duration-Context } + /** + * Code snippets for {@link DataLakePathClient#exists()} + */ + public void existsCodeSnippet() { + // BEGIN: com.azure.storage.file.datalake.DataLakePathClient.exists + System.out.printf("Exists? %b%n", client.exists()); + // END: com.azure.storage.file.datalake.DataLakePathClient.exists + } + + /** + * Code snippet for {@link DataLakePathClient#existsWithResponse(Duration, Context)} + */ + public void existsWithResponseCodeSnippet() { + // BEGIN: com.azure.storage.file.datalake.DataLakePathClient.existsWithResponse#Duration-Context + System.out.printf("Exists? %b%n", client.existsWithResponse(timeout, new Context(key2, value2)).getValue()); + // END: com.azure.storage.file.datalake.DataLakePathClient.existsWithResponse#Duration-Context + } + /** * Code snippets for {@link DataLakePathClient#setAccessControlList(List, String, String)} */ diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/DirectoryAPITest.groovy b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/DirectoryAPITest.groovy index a06d6ef06fe7..761f68166d90 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/DirectoryAPITest.groovy +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/DirectoryAPITest.groovy @@ -64,6 +64,20 @@ class DirectoryAPITest extends APISpec { thrown(Exception) } + def "Exists"() { + when: + dc = fsc.getDirectoryClient(generatePathName()) + dc.create() + + then: + dc.exists() + } + + def "Does not exist"() { + expect: + !fsc.getDirectoryClient(generatePathName()).exists() + } + @Unroll def "Create headers"() { // Create does not set md5 diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileAPITest.groovy b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileAPITest.groovy index 51056d01a440..0365804428e8 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileAPITest.groovy +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileAPITest.groovy @@ -68,6 +68,20 @@ class FileAPITest extends APISpec { thrown(StorageErrorException) } + def "Exists"() { + when: + fc = fsc.getFileClient(generatePathName()) + fc.create() + + then: + fc.exists() + } + + def "Does not exist"() { + expect: + !fsc.getFileClient(generatePathName()).exists() + } + @Unroll def "Create headers"() { // Create does not set md5 diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestdoesnotexist.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestdoesnotexist.json new file mode 100644 index 000000000000..2ba30788219e --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestdoesnotexist.json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gaprahns.blob.core.windows.net/jtfsdoesnotexist0directoryapitestdoesnotexistacb932268c8d6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "1529a7a4-981e-4701-82ff-d6359ec045ad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77E7D2CA6187F", + "Last-Modified" : "Wed, 11 Dec 2019 21:00:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c14d990b-001e-007d-4566-b0d2b2000000", + "Date" : "Wed, 11 Dec 2019 21:00:37 GMT", + "x-ms-client-request-id" : "1529a7a4-981e-4701-82ff-d6359ec045ad" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gaprahns.dfs.core.windows.net/jtfsdoesnotexist0directoryapitestdoesnotexistacb932268c8d6/javapathdoesnotexist1directoryapitestdoesnotexistacb73766c26?resource=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file-datalake/12.0.0-beta.8 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "8c26ea54-c7b3-48fd-9417-5bf3bbdf42c0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77E7D2CE5EE11", + "Last-Modified" : "Wed, 11 Dec 2019 21:00:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7be34692-701f-0050-1666-b05172000000", + "Date" : "Wed, 11 Dec 2019 21:00:38 GMT", + "x-ms-client-request-id" : "8c26ea54-c7b3-48fd-9417-5bf3bbdf42c0" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://gaprahns.blob.core.windows.net/jtfsdoesnotexist0directoryapitestdoesnotexistacb932268c8d6/javapathdoesnotexist2directoryapitestdoesnotexistacb04530104", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "1f03d86a-429c-4a71-9b6c-ec423c143b1f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "BlobNotFound", + "retry-after" : "0", + "StatusCode" : "404", + "x-ms-request-id" : "c14d99dd-001e-007d-0166-b0d2b2000000", + "Date" : "Wed, 11 Dec 2019 21:00:38 GMT", + "x-ms-client-request-id" : "1f03d86a-429c-4a71-9b6c-ec423c143b1f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gaprahns.blob.core.windows.net?prefix=jtfsdoesnotexist&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "5d9f0c9b-6ecb-42c2-a7f2-789a4ffd9cbc" + }, + "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" : "c14d9a00-001e-007d-1b66-b0d2b2000000", + "Body" : "jtfsdoesnotexistjtfsdoesnotexist0directoryapitestdoesnotexistacb932268c8d6Wed, 11 Dec 2019 21:00:38 GMT\"0x8D77E7D2CA6187F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Wed, 11 Dec 2019 21:00:38 GMT", + "x-ms-client-request-id" : "5d9f0c9b-6ecb-42c2-a7f2-789a4ffd9cbc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gaprahns.blob.core.windows.net/jtfsdoesnotexist0directoryapitestdoesnotexistacb932268c8d6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "e78e49c7-4709-4341-abfa-d166bd539942" + }, + "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" : "c14d9a3b-001e-007d-5466-b0d2b2000000", + "Date" : "Wed, 11 Dec 2019 21:00:38 GMT", + "x-ms-client-request-id" : "e78e49c7-4709-4341-abfa-d166bd539942" + }, + "Exception" : null + } ], + "variables" : [ "jtfsdoesnotexist0directoryapitestdoesnotexistacb932268c8d6", "javapathdoesnotexist1directoryapitestdoesnotexistacb73766c26", "javapathdoesnotexist2directoryapitestdoesnotexistacb04530104" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestexists.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestexists.json new file mode 100644 index 000000000000..61f627de760b --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestexists.json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gaprahns.blob.core.windows.net/jtfsexists0directoryapitestexistsfba38603baeb5fc3d5e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "4a04eb2a-aa18-45e1-b4de-939995bb5b5c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77E7D28F311D1", + "Last-Modified" : "Wed, 11 Dec 2019 21:00:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "733ebaa1-301e-011c-3a66-b0d038000000", + "Date" : "Wed, 11 Dec 2019 21:00:31 GMT", + "x-ms-client-request-id" : "4a04eb2a-aa18-45e1-b4de-939995bb5b5c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gaprahns.dfs.core.windows.net/jtfsexists0directoryapitestexistsfba38603baeb5fc3d5e/javapathexists1directoryapitestexistsfba78263018aed6ca?resource=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file-datalake/12.0.0-beta.8 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "40bcbb8f-d53b-47a8-bc34-b9494aefc5c9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77E7D292E6837", + "Last-Modified" : "Wed, 11 Dec 2019 21:00:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ea2e999a-201f-002e-2966-b0cebd000000", + "Date" : "Wed, 11 Dec 2019 21:00:31 GMT", + "x-ms-client-request-id" : "40bcbb8f-d53b-47a8-bc34-b9494aefc5c9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gaprahns.dfs.core.windows.net/jtfsexists0directoryapitestexistsfba38603baeb5fc3d5e/javapathexists2directoryapitestexistsfba128352a9fb51d7?resource=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file-datalake/12.0.0-beta.8 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "46c45036-2724-4fd6-8226-0bd90a43995d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77E7D29380DA7", + "Last-Modified" : "Wed, 11 Dec 2019 21:00:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ea2e999b-201f-002e-2a66-b0cebd000000", + "Date" : "Wed, 11 Dec 2019 21:00:31 GMT", + "x-ms-client-request-id" : "46c45036-2724-4fd6-8226-0bd90a43995d" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://gaprahns.blob.core.windows.net/jtfsexists0directoryapitestexistsfba38603baeb5fc3d5e/javapathexists2directoryapitestexistsfba128352a9fb51d7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "858f9cf6-7a94-4d3c-9cfa-485a19f0de11" + }, + "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" : "Wed, 11 Dec 2019 21:00:32 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Wed, 11 Dec 2019 21:00:31 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-meta-hdi_isfolder" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "0x8D77E7D29380DA7", + "x-ms-creation-time" : "Wed, 11 Dec 2019 21:00:32 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "733ebb3a-301e-011c-4066-b0d038000000", + "x-ms-client-request-id" : "858f9cf6-7a94-4d3c-9cfa-485a19f0de11", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gaprahns.blob.core.windows.net?prefix=jtfsexists&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "3929ce42-69d7-4ab5-8437-23ec20795a6b" + }, + "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" : "733ebb67-301e-011c-6466-b0d038000000", + "Body" : "jtfsexistsjtfsexists0directoryapitestexistsfba38603baeb5fc3d5eWed, 11 Dec 2019 21:00:31 GMT\"0x8D77E7D28F311D1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Wed, 11 Dec 2019 21:00:31 GMT", + "x-ms-client-request-id" : "3929ce42-69d7-4ab5-8437-23ec20795a6b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gaprahns.blob.core.windows.net/jtfsexists0directoryapitestexistsfba38603baeb5fc3d5e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "dc0dba1b-8544-4c25-bb78-aefc7b48635f" + }, + "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" : "733ebb80-301e-011c-7d66-b0d038000000", + "Date" : "Wed, 11 Dec 2019 21:00:31 GMT", + "x-ms-client-request-id" : "dc0dba1b-8544-4c25-bb78-aefc7b48635f" + }, + "Exception" : null + } ], + "variables" : [ "jtfsexists0directoryapitestexistsfba38603baeb5fc3d5e", "javapathexists1directoryapitestexistsfba78263018aed6ca", "javapathexists2directoryapitestexistsfba128352a9fb51d7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/FileAPITestdoesnotexist.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/FileAPITestdoesnotexist.json new file mode 100644 index 000000000000..9a374f3aff91 --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/FileAPITestdoesnotexist.json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gaprahns.blob.core.windows.net/jtfsdoesnotexist0fileapitestdoesnotexistda67219783e899e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "64b8c482-9fa7-4f23-8846-e2b7d082135c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77E7D14D887F0", + "Last-Modified" : "Wed, 11 Dec 2019 20:59:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "bb22f8b2-501e-00c4-5965-b031bc000000", + "Date" : "Wed, 11 Dec 2019 20:59:58 GMT", + "x-ms-client-request-id" : "64b8c482-9fa7-4f23-8846-e2b7d082135c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gaprahns.dfs.core.windows.net/jtfsdoesnotexist0fileapitestdoesnotexistda67219783e899e/javapathdoesnotexist1fileapitestdoesnotexistda673750003f5?resource=file", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file-datalake/12.0.0-beta.8 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "beb93850-25e7-489e-bf88-5542d866b7a2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77E7D150E23EC", + "Last-Modified" : "Wed, 11 Dec 2019 20:59:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "5cce8639-f01f-00a4-2665-b0749e000000", + "Date" : "Wed, 11 Dec 2019 20:59:58 GMT", + "x-ms-client-request-id" : "beb93850-25e7-489e-bf88-5542d866b7a2" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://gaprahns.blob.core.windows.net/jtfsdoesnotexist0fileapitestdoesnotexistda67219783e899e/javapathdoesnotexist2fileapitestdoesnotexistda60720970342", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "2f10a53a-6ad0-4d4f-b20b-28837ceb34db" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "BlobNotFound", + "retry-after" : "0", + "StatusCode" : "404", + "x-ms-request-id" : "bb22f9ba-501e-00c4-5665-b031bc000000", + "Date" : "Wed, 11 Dec 2019 20:59:58 GMT", + "x-ms-client-request-id" : "2f10a53a-6ad0-4d4f-b20b-28837ceb34db" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gaprahns.blob.core.windows.net?prefix=jtfsdoesnotexist&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "46d99af8-8a43-463e-9487-3f3b26a5126d" + }, + "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" : "bb22fa11-501e-00c4-2865-b031bc000000", + "Body" : "jtfsdoesnotexistjtfsdoesnotexist0fileapitestdoesnotexistda67219783e899eWed, 11 Dec 2019 20:59:58 GMT\"0x8D77E7D14D887F0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Wed, 11 Dec 2019 20:59:58 GMT", + "x-ms-client-request-id" : "46d99af8-8a43-463e-9487-3f3b26a5126d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gaprahns.blob.core.windows.net/jtfsdoesnotexist0fileapitestdoesnotexistda67219783e899e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "281d6679-b4e0-433c-9bd7-c70766cf5cce" + }, + "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" : "bb22fa59-501e-00c4-6f65-b031bc000000", + "Date" : "Wed, 11 Dec 2019 20:59:58 GMT", + "x-ms-client-request-id" : "281d6679-b4e0-433c-9bd7-c70766cf5cce" + }, + "Exception" : null + } ], + "variables" : [ "jtfsdoesnotexist0fileapitestdoesnotexistda67219783e899e", "javapathdoesnotexist1fileapitestdoesnotexistda673750003f5", "javapathdoesnotexist2fileapitestdoesnotexistda60720970342" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/FileAPITestexists.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/FileAPITestexists.json new file mode 100644 index 000000000000..ca136db669a9 --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/FileAPITestexists.json @@ -0,0 +1,137 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gaprahns.blob.core.windows.net/jtfsexists0fileapitestexists25c1898863f152de66784?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "90e0b61c-bb9a-45c8-bee0-a4a540e3b710" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77E7D0E4B365D", + "Last-Modified" : "Wed, 11 Dec 2019 20:59:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "06e24b34-001e-00dc-2a65-b01c29000000", + "Date" : "Wed, 11 Dec 2019 20:59:46 GMT", + "x-ms-client-request-id" : "90e0b61c-bb9a-45c8-bee0-a4a540e3b710" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gaprahns.dfs.core.windows.net/jtfsexists0fileapitestexists25c1898863f152de66784/javapathexists1fileapitestexists25c8535548cd732679a?resource=file", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file-datalake/12.0.0-beta.8 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "9f9f6970-e0d7-42cb-a8ef-641de35ae597" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77E7D0EA1090F", + "Last-Modified" : "Wed, 11 Dec 2019 20:59:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9780849a-c01f-0042-2765-b0656e000000", + "Date" : "Wed, 11 Dec 2019 20:59:47 GMT", + "x-ms-client-request-id" : "9f9f6970-e0d7-42cb-a8ef-641de35ae597" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gaprahns.dfs.core.windows.net/jtfsexists0fileapitestexists25c1898863f152de66784/javapathexists2fileapitestexists25c33113f0c99a86b34?resource=file", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file-datalake/12.0.0-beta.8 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "dd4e461c-926f-4f85-936a-ece4dc30fd7c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77E7D0EAC4BAD", + "Last-Modified" : "Wed, 11 Dec 2019 20:59:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9780849b-c01f-0042-2865-b0656e000000", + "Date" : "Wed, 11 Dec 2019 20:59:47 GMT", + "x-ms-client-request-id" : "dd4e461c-926f-4f85-936a-ece4dc30fd7c" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://gaprahns.blob.core.windows.net/jtfsexists0fileapitestexists25c1898863f152de66784/javapathexists2fileapitestexists25c33113f0c99a86b34", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "42a3c8b6-8f59-4c6b-8799-5c3f2741230d" + }, + "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" : "Wed, 11 Dec 2019 20:59:47 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Wed, 11 Dec 2019 20:59:47 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "0x8D77E7D0EAC4BAD", + "x-ms-creation-time" : "Wed, 11 Dec 2019 20:59:47 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "06e24d55-001e-00dc-1e65-b01c29000000", + "x-ms-client-request-id" : "42a3c8b6-8f59-4c6b-8799-5c3f2741230d", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gaprahns.blob.core.windows.net?prefix=jtfsexists&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "227fafd8-a153-4783-99e8-d09a25ce3816" + }, + "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" : "06e24dca-001e-00dc-0865-b01c29000000", + "Body" : "jtfsexistsjtfsexists0fileapitestexists25c1898863f152de66784Wed, 11 Dec 2019 20:59:47 GMT\"0x8D77E7D0E4B365D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Wed, 11 Dec 2019 20:59:47 GMT", + "x-ms-client-request-id" : "227fafd8-a153-4783-99e8-d09a25ce3816", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gaprahns.blob.core.windows.net/jtfsexists0fileapitestexists25c1898863f152de66784?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "58c8f913-9b2b-4673-8bb9-172124594628" + }, + "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" : "06e24e1d-001e-00dc-5565-b01c29000000", + "Date" : "Wed, 11 Dec 2019 20:59:47 GMT", + "x-ms-client-request-id" : "58c8f913-9b2b-4673-8bb9-172124594628" + }, + "Exception" : null + } ], + "variables" : [ "jtfsexists0fileapitestexists25c1898863f152de66784", "javapathexists1fileapitestexists25c8535548cd732679a", "javapathexists2fileapitestexists25c33113f0c99a86b34" ] +} \ No newline at end of file