From b660082430bd2773e230b0f63a8ead1c18ef1c65 Mon Sep 17 00:00:00 2001 From: Gauri Prasad Date: Mon, 9 Dec 2019 15:24:23 -0800 Subject: [PATCH 01/12] Changed storageerrorexception to datalakestorageexception --- .../implementation/FileSystemsImpl.java | 12 ++-- .../datalake/implementation/PathsImpl.java | 20 +++---- .../datalake/implementation/ServicesImpl.java | 4 +- .../models/DataLakeStorageException.java | 56 +++++++++++++++++++ .../storage/file/datalake/APISpec.groovy | 18 +++--- .../file/datalake/DirectoryAPITest.groovy | 48 ++++++++-------- .../storage/file/datalake/FileAPITest.groovy | 52 ++++++++--------- .../file/datalake/FileSystemAPITest.groovy | 18 +++--- .../storage/file/datalake/SASTest.groovy | 5 +- .../swagger/README.md | 42 ++++++++++++++ 10 files changed, 187 insertions(+), 88 deletions(-) create mode 100644 sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/models/DataLakeStorageException.java diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/FileSystemsImpl.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/FileSystemsImpl.java index 8a66210bf0e5..d1c9e3872e88 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/FileSystemsImpl.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/FileSystemsImpl.java @@ -28,7 +28,7 @@ import com.azure.storage.file.datalake.implementation.models.FileSystemsListPathsResponse; import com.azure.storage.file.datalake.implementation.models.FileSystemsSetPropertiesResponse; import com.azure.storage.file.datalake.implementation.models.ModifiedAccessConditions; -import com.azure.storage.file.datalake.implementation.models.StorageErrorException; +import com.azure.storage.file.datalake.models.DataLakeStorageException; import java.time.OffsetDateTime; import reactor.core.publisher.Mono; @@ -67,27 +67,27 @@ public FileSystemsImpl(DataLakeStorageClientImpl client) { private interface FileSystemsService { @Put("{filesystem}") @ExpectedResponses({201}) - @UnexpectedResponseExceptionType(StorageErrorException.class) + @UnexpectedResponseExceptionType(DataLakeStorageException.class) Mono create(@HostParam("url") String url, @HeaderParam("x-ms-properties") String properties, @QueryParam("resource") String resource, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, Context context); @Patch("{filesystem}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) + @UnexpectedResponseExceptionType(DataLakeStorageException.class) Mono setProperties(@HostParam("url") String url, @HeaderParam("x-ms-properties") String properties, @QueryParam("resource") String resource, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); @Head("{filesystem}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) + @UnexpectedResponseExceptionType(DataLakeStorageException.class) Mono getProperties(@HostParam("url") String url, @QueryParam("resource") String resource, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, Context context); @Delete("{filesystem}") @ExpectedResponses({202}) - @UnexpectedResponseExceptionType(StorageErrorException.class) + @UnexpectedResponseExceptionType(DataLakeStorageException.class) Mono delete(@HostParam("url") String url, @QueryParam("resource") String resource, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); @Get("{filesystem}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) + @UnexpectedResponseExceptionType(DataLakeStorageException.class) Mono listPaths(@PathParam("filesystem") String fileSystem, @HostParam("url") String url, @QueryParam("continuation") String continuation, @QueryParam("directory") String path, @QueryParam("recursive") boolean recursive, @QueryParam("maxResults") Integer maxResults, @QueryParam("upn") Boolean upn, @QueryParam("resource") String resource, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, Context context); } diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/PathsImpl.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/PathsImpl.java index 3001733b72c4..4b53a710a16d 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/PathsImpl.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/PathsImpl.java @@ -42,7 +42,7 @@ import com.azure.storage.file.datalake.implementation.models.PathsUpdateResponse; import com.azure.storage.file.datalake.implementation.models.PathUpdateAction; import com.azure.storage.file.datalake.implementation.models.SourceModifiedAccessConditions; -import com.azure.storage.file.datalake.implementation.models.StorageErrorException; +import com.azure.storage.file.datalake.models.DataLakeStorageException; import com.azure.storage.file.datalake.models.PathHttpHeaders; import java.nio.ByteBuffer; import java.time.OffsetDateTime; @@ -83,47 +83,47 @@ public PathsImpl(DataLakeStorageClientImpl client) { private interface PathsService { @Put("{filesystem}/{path}") @ExpectedResponses({201}) - @UnexpectedResponseExceptionType(StorageErrorException.class) + @UnexpectedResponseExceptionType(DataLakeStorageException.class) Mono create(@PathParam("filesystem") String fileSystem, @PathParam("path") String path1, @HostParam("url") String url, @QueryParam("resource") PathResourceType resource, @QueryParam("continuation") String continuation, @QueryParam("mode") PathRenameMode mode, @HeaderParam("x-ms-rename-source") String renameSource, @HeaderParam("x-ms-source-lease-id") String sourceLeaseId, @HeaderParam("x-ms-properties") String properties, @HeaderParam("x-ms-permissions") String permissions, @HeaderParam("x-ms-umask") String umask, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-cache-control") String cacheControl, @HeaderParam("x-ms-content-encoding") String contentEncoding, @HeaderParam("x-ms-content-language") String contentLanguage, @HeaderParam("x-ms-content-disposition") String contentDisposition, @HeaderParam("x-ms-content-type") String contentType, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, Context context); @Patch("{filesystem}/{path}") @ExpectedResponses({200, 202}) - @UnexpectedResponseExceptionType(StorageErrorException.class) + @UnexpectedResponseExceptionType(DataLakeStorageException.class) Mono update(@PathParam("filesystem") String fileSystem, @PathParam("path") String path1, @HostParam("url") String url, @QueryParam("action") PathUpdateAction action, @QueryParam("position") Long position, @QueryParam("retainUncommittedData") Boolean retainUncommittedData, @QueryParam("close") Boolean close, @HeaderParam("Content-Length") Long contentLength, @HeaderParam("x-ms-properties") String properties, @HeaderParam("x-ms-owner") String owner, @HeaderParam("x-ms-group") String group, @HeaderParam("x-ms-permissions") String permissions, @HeaderParam("x-ms-acl") String acl, @BodyParam("application/octet-stream") Flux body, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-content-md5") String contentMd5, @HeaderParam("x-ms-cache-control") String cacheControl, @HeaderParam("x-ms-content-type") String contentType, @HeaderParam("x-ms-content-disposition") String contentDisposition, @HeaderParam("x-ms-content-encoding") String contentEncoding, @HeaderParam("x-ms-content-language") String contentLanguage, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); @Post("{filesystem}/{path}") @ExpectedResponses({200, 201, 202}) - @UnexpectedResponseExceptionType(StorageErrorException.class) + @UnexpectedResponseExceptionType(DataLakeStorageException.class) Mono lease(@PathParam("filesystem") String fileSystem, @PathParam("path") String path1, @HostParam("url") String url, @HeaderParam("x-ms-lease-action") PathLeaseAction xMsLeaseAction, @HeaderParam("x-ms-lease-duration") Integer xMsLeaseDuration, @HeaderParam("x-ms-lease-break-period") Integer xMsLeaseBreakPeriod, @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); @Get("{filesystem}/{path}") @ExpectedResponses({200, 206}) - @UnexpectedResponseExceptionType(StorageErrorException.class) + @UnexpectedResponseExceptionType(DataLakeStorageException.class) Mono read(@PathParam("filesystem") String fileSystem, @PathParam("path") String path1, @HostParam("url") String url, @HeaderParam("Range") String range, @HeaderParam("x-ms-range-get-content-md5") Boolean xMsRangeGetContentMd5, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); @Head("{filesystem}/{path}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) + @UnexpectedResponseExceptionType(DataLakeStorageException.class) Mono getProperties(@PathParam("filesystem") String fileSystem, @PathParam("path") String path1, @HostParam("url") String url, @QueryParam("action") PathGetPropertiesAction action, @QueryParam("upn") Boolean upn, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); @Delete("{filesystem}/{path}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) + @UnexpectedResponseExceptionType(DataLakeStorageException.class) Mono delete(@PathParam("filesystem") String fileSystem, @PathParam("path") String path1, @HostParam("url") String url, @QueryParam("recursive") Boolean recursive, @QueryParam("continuation") String continuation, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); @Patch("{filesystem}/{path}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) + @UnexpectedResponseExceptionType(DataLakeStorageException.class) Mono setAccessControl(@PathParam("filesystem") String fileSystem, @PathParam("path") String path1, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-owner") String owner, @HeaderParam("x-ms-group") String group, @HeaderParam("x-ms-permissions") String permissions, @HeaderParam("x-ms-acl") String acl, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-version") String version, @QueryParam("action") String action, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); @Patch("{filesystem}/{path}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) + @UnexpectedResponseExceptionType(DataLakeStorageException.class) Mono flushData(@PathParam("filesystem") String fileSystem, @PathParam("path") String path1, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @QueryParam("position") Long position, @QueryParam("retainUncommittedData") Boolean retainUncommittedData, @QueryParam("close") Boolean close, @HeaderParam("Content-Length") Long contentLength, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-version") String version, @QueryParam("action") String action, @HeaderParam("x-ms-content-md5") String contentMd5, @HeaderParam("x-ms-cache-control") String cacheControl, @HeaderParam("x-ms-content-type") String contentType, @HeaderParam("x-ms-content-disposition") String contentDisposition, @HeaderParam("x-ms-content-encoding") String contentEncoding, @HeaderParam("x-ms-content-language") String contentLanguage, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); @Patch("{filesystem}/{path}") @ExpectedResponses({202}) - @UnexpectedResponseExceptionType(StorageErrorException.class) + @UnexpectedResponseExceptionType(DataLakeStorageException.class) Mono appendData(@PathParam("filesystem") String fileSystem, @PathParam("path") String path1, @HostParam("url") String url, @QueryParam("position") Long position, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") Long contentLength, @BodyParam("application/octet-stream") Flux body, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-version") String version, @QueryParam("action") String action, @HeaderParam("Content-MD5") String transactionalContentHash, @HeaderParam("x-ms-lease-id") String leaseId, Context context); } diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/ServicesImpl.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/ServicesImpl.java index 52076dba2570..895f4b05bc55 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/ServicesImpl.java @@ -17,7 +17,7 @@ import com.azure.core.http.rest.RestProxy; import com.azure.core.util.Context; import com.azure.storage.file.datalake.implementation.models.ServicesListFileSystemsResponse; -import com.azure.storage.file.datalake.implementation.models.StorageErrorException; +import com.azure.storage.file.datalake.models.DataLakeStorageException; import reactor.core.publisher.Mono; /** @@ -55,7 +55,7 @@ public ServicesImpl(DataLakeStorageClientImpl client) { private interface ServicesService { @Get("") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) + @UnexpectedResponseExceptionType(DataLakeStorageException.class) Mono listFileSystems(@HostParam("url") String url, @QueryParam("resource") String resource, @QueryParam("prefix") String prefix, @QueryParam("continuation") String continuation, @QueryParam("maxResults") Integer maxResults, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, Context context); } diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/models/DataLakeStorageException.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/models/DataLakeStorageException.java new file mode 100644 index 000000000000..7e25617397e7 --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/models/DataLakeStorageException.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file.datalake.models; + +import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.HttpResponse; + +import static com.azure.storage.common.implementation.Constants.HeaderConstants.ERROR_CODE; + +/** + * A {@code DataLakeStorageException} is thrown whenever Azure Storage successfully returns an error code that is not + * 200-level. Users can inspect the status code and error code to determine the cause of the error response. The + * exception message may also contain more detailed information depending on the type of error. The user may also + * inspect the raw HTTP response or call toString to get the full payload of the error response if present. Note that + * even some expected "errors" will be thrown as a {@code DataLakeStorageException}. For example, some users may perform + * a getProperties request on an entity to determine whether it exists or not. If it does not exists, an exception will + * be thrown even though this may be considered an expected indication of absence in this case. + * + *

Sample Code

+ *

For more samples, please see the sample + * file

+ */ +public final class DataLakeStorageException extends HttpResponseException { + /** + * Constructs a {@code DataLakeStorageException}. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + * @param value the error code of the exception. + */ + public DataLakeStorageException(String message, HttpResponse response, Object value) { + super(message, response, value); + } + + /** + * @return The error code returned by the service. + */ + public String getErrorCode() { + return super.getResponse().getHeaders().getValue(ERROR_CODE); + } + + /** + * @return The message returned by the service. + */ + public String getServiceMessage() { + return super.getMessage(); + } + + /** + * @return The status code on the response. + */ + public int getStatusCode() { + return super.getResponse().getStatusCode(); + } +} diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/APISpec.groovy b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/APISpec.groovy index a1dd75362b39..58a1eae4638f 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/APISpec.groovy +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/APISpec.groovy @@ -163,15 +163,15 @@ class APISpec extends Specification { } static TestMode setupTestMode() { - String testMode = Configuration.getGlobalConfiguration().get(AZURE_TEST_MODE) - - if (testMode != null) { - try { - return TestMode.valueOf(testMode.toUpperCase(Locale.US)) - } catch (IllegalArgumentException ignore) { - return TestMode.PLAYBACK - } - } +// String testMode = Configuration.getGlobalConfiguration().get(AZURE_TEST_MODE) +// +// if (testMode != null) { +// try { +// return TestMode.valueOf(testMode.toUpperCase(Locale.US)) +// } catch (IllegalArgumentException ignore) { +// return TestMode.PLAYBACK +// } +// } return TestMode.PLAYBACK } 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..607e4e6f5223 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 @@ -61,7 +61,7 @@ class DirectoryAPITest extends APISpec { Context.NONE) then: - thrown(Exception) + thrown(DataLakeStorageException) } @Unroll @@ -160,7 +160,7 @@ class DirectoryAPITest extends APISpec { dc.createWithResponse(null, null, null, null, drc, null, Context.NONE) then: - thrown(Exception) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -243,7 +243,7 @@ class DirectoryAPITest extends APISpec { dc.deleteWithResponse(false, drc, null, null).getStatusCode() then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -259,7 +259,7 @@ class DirectoryAPITest extends APISpec { def resp = dc.setPermissions(permissions, group, owner) then: - notThrown(StorageErrorException) + notThrown(DataLakeStorageException) resp.getETag() resp.getLastModified() } @@ -310,7 +310,7 @@ class DirectoryAPITest extends APISpec { dc.setPermissionsWithResponse(permissions, group, owner, drc, null, Context.NONE).getStatusCode() == 200 then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -329,7 +329,7 @@ class DirectoryAPITest extends APISpec { dc.setPermissionsWithResponse(permissions, group, owner, null, null, null) then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) } def "Set ACL min"() { @@ -337,7 +337,7 @@ class DirectoryAPITest extends APISpec { def resp = dc.setAccessControlList(pathAccessControlEntries, group, owner) then: - notThrown(StorageErrorException) + notThrown(DataLakeStorageException) resp.getETag() resp.getLastModified() } @@ -388,7 +388,7 @@ class DirectoryAPITest extends APISpec { dc.setAccessControlListWithResponse(pathAccessControlEntries, group, owner, drc, null, Context.NONE).getStatusCode() == 200 then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -407,7 +407,7 @@ class DirectoryAPITest extends APISpec { dc.setAccessControlList(pathAccessControlEntries, group, owner) then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) } def "Get access control min"() { @@ -415,7 +415,7 @@ class DirectoryAPITest extends APISpec { PathAccessControl pac = dc.getAccessControl() then: - notThrown(StorageErrorException) + notThrown(DataLakeStorageException) pac.getAccessControlList() pac.getPermissions() pac.getOwner() @@ -473,7 +473,7 @@ class DirectoryAPITest extends APISpec { dc.getAccessControlWithResponse(false, drc, null, null).getStatusCode() == 200 then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -498,7 +498,7 @@ class DirectoryAPITest extends APISpec { renamedClient.getProperties() then: - notThrown(StorageErrorException) + notThrown(DataLakeStorageException) when: dc.getProperties() @@ -515,7 +515,7 @@ class DirectoryAPITest extends APISpec { dc.renameWithResponse(generatePathName(), null, null, null, null) then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) } @Unroll @@ -559,7 +559,7 @@ class DirectoryAPITest extends APISpec { dc.renameWithResponse(generatePathName(), drc, null, null, null) then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -617,7 +617,7 @@ class DirectoryAPITest extends APISpec { dc.renameWithResponse(pathName, null, drc, null, null) then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -964,7 +964,7 @@ class DirectoryAPITest extends APISpec { dc.getFileClient(generatePathName()).create() then: - notThrown(StorageErrorException) + notThrown(DataLakeStorageException) } def "Create file defaults"() { @@ -982,7 +982,7 @@ class DirectoryAPITest extends APISpec { Context.NONE) then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) } @Unroll @@ -1083,7 +1083,7 @@ class DirectoryAPITest extends APISpec { dc.createFileWithResponse(pathName, null, null, null, null, drc, null, Context.NONE) then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -1169,7 +1169,7 @@ class DirectoryAPITest extends APISpec { dc.deleteFileWithResponse(pathName, drc, null, null).getStatusCode() then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -1186,7 +1186,7 @@ class DirectoryAPITest extends APISpec { subdir.create() then: - notThrown(StorageErrorException) + notThrown(DataLakeStorageException) } def "Create sub dir defaults"() { @@ -1205,7 +1205,7 @@ class DirectoryAPITest extends APISpec { Context.NONE) then: - thrown(Exception) + thrown(DataLakeStorageException) } @Unroll @@ -1310,7 +1310,7 @@ class DirectoryAPITest extends APISpec { dc.createSubdirectoryWithResponse(pathName, null, null, null, null, drc, null, Context.NONE) then: - thrown(Exception) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -1403,7 +1403,7 @@ class DirectoryAPITest extends APISpec { dc.deleteSubdirectoryWithResponse(pathName, false, drc, null, null).getStatusCode() then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -1532,6 +1532,6 @@ class DirectoryAPITest extends APISpec { dirClient.getAccessControl() then: - notThrown(StorageErrorException) + notThrown(DataLakeStorageException) } } 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..6e818e9aa3bb 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 @@ -41,7 +41,7 @@ class FileAPITest extends APISpec { fc.create() then: - notThrown(StorageErrorException) + notThrown(DataLakeStorageException) } def "Create defaults"() { @@ -65,7 +65,7 @@ class FileAPITest extends APISpec { Context.NONE) then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) } @Unroll @@ -161,7 +161,7 @@ class FileAPITest extends APISpec { fc.createWithResponse(null, null, null, null, drc, null, Context.NONE) then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -239,7 +239,7 @@ class FileAPITest extends APISpec { fc.deleteWithResponse(drc, null, null).getStatusCode() then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -255,7 +255,7 @@ class FileAPITest extends APISpec { def resp = fc.setPermissions(permissions, group, owner) then: - notThrown(StorageErrorException) + notThrown(DataLakeStorageException) resp.getETag() resp.getLastModified() } @@ -306,7 +306,7 @@ class FileAPITest extends APISpec { fc.setPermissionsWithResponse(permissions, group, owner, drc, null, Context.NONE).getStatusCode() == 200 then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -325,7 +325,7 @@ class FileAPITest extends APISpec { fc.setPermissionsWithResponse(permissions, group, owner, null, null, null) then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) } def "Set ACL min"() { @@ -333,7 +333,7 @@ class FileAPITest extends APISpec { def resp = fc.setAccessControlList(pathAccessControlEntries, group, owner) then: - notThrown(StorageErrorException) + notThrown(DataLakeStorageException) resp.getETag() resp.getLastModified() } @@ -384,7 +384,7 @@ class FileAPITest extends APISpec { fc.setAccessControlListWithResponse(pathAccessControlEntries, group, owner, drc, null, Context.NONE).getStatusCode() == 200 then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -403,7 +403,7 @@ class FileAPITest extends APISpec { fc.setAccessControlList(pathAccessControlEntries, group, owner) then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) } def "Get access control min"() { @@ -411,7 +411,7 @@ class FileAPITest extends APISpec { PathAccessControl pac = fc.getAccessControl() then: - notThrown(StorageErrorException) + notThrown(DataLakeStorageException) pac.getAccessControlList() pac.getPermissions() pac.getOwner() @@ -470,7 +470,7 @@ class FileAPITest extends APISpec { fc.getAccessControlWithResponse(false, drc, null, null).getStatusCode() == 200 then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -1010,7 +1010,7 @@ class FileAPITest extends APISpec { renamedClient.getProperties() then: - notThrown(StorageErrorException) + notThrown(DataLakeStorageException) when: fc.getProperties() @@ -1027,7 +1027,7 @@ class FileAPITest extends APISpec { fc.renameWithResponse(generatePathName(), null, null, null, null) then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) } @Unroll @@ -1074,7 +1074,7 @@ class FileAPITest extends APISpec { fc.renameWithResponse(generatePathName(), drc, null, null, null) then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -1132,7 +1132,7 @@ class FileAPITest extends APISpec { fc.renameWithResponse(pathName, null, drc, null, null) then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -1148,7 +1148,7 @@ class FileAPITest extends APISpec { fc.append(new ByteArrayInputStream(defaultData.array()), 0, defaultDataSize) then: - notThrown(StorageErrorException) + notThrown(DataLakeStorageException) } def "Append data"() { @@ -1202,7 +1202,7 @@ class FileAPITest extends APISpec { fc.append(new ByteArrayInputStream(new byte[0]), 0, 0) then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) } def "Append data null body"() { @@ -1231,7 +1231,7 @@ class FileAPITest extends APISpec { fc.appendWithResponse(defaultInputStream.get(), 0, defaultDataSize, null, garbageLeaseID, null, null) then: - def e = thrown(StorageErrorException) + def e = thrown(DataLakeStorageException) e.getResponse().getStatusCode() == 412 } @@ -1243,7 +1243,7 @@ class FileAPITest extends APISpec { fc.appendWithResponse(defaultInputStream.get(), 0, defaultDataSize, null, null, null, null) then: - def e = thrown(StorageErrorException) + def e = thrown(DataLakeStorageException) e.getResponse().getStatusCode() == 404 } @@ -1253,7 +1253,7 @@ class FileAPITest extends APISpec { fc.flush(defaultDataSize) then: - notThrown(StorageErrorException) + notThrown(DataLakeStorageException) } def "Flush close"() { @@ -1264,7 +1264,7 @@ class FileAPITest extends APISpec { fc.flushWithResponse(defaultDataSize, false, true, null, null, null, null) then: - notThrown(StorageErrorException) + notThrown(DataLakeStorageException) } def "Flush retain uncommitted data "() { @@ -1275,7 +1275,7 @@ class FileAPITest extends APISpec { fc.flushWithResponse(defaultDataSize, true, false, null, null, null, null) then: - notThrown(StorageErrorException) + notThrown(DataLakeStorageException) } def "Flush IA"() { @@ -1286,7 +1286,7 @@ class FileAPITest extends APISpec { fc.flushWithResponse(4, false, false, null, null, null, null) then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) } @Unroll @@ -1366,7 +1366,7 @@ class FileAPITest extends APISpec { when: fc.flushWithResponse(defaultDataSize, false, false, null, drc, null, null) then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -1385,7 +1385,7 @@ class FileAPITest extends APISpec { fc.flush(1) then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) } def "Get File Name and Build Client"() { diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileSystemAPITest.groovy b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileSystemAPITest.groovy index ce46723f3273..93ea005141b8 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileSystemAPITest.groovy +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileSystemAPITest.groovy @@ -38,7 +38,7 @@ class FileSystemAPITest extends APISpec { then: fsc.getProperties() - notThrown(Exception) + notThrown(DataLakeStorageException) } @Unroll @@ -363,7 +363,7 @@ class FileSystemAPITest extends APISpec { fsc.createFile(generatePathName()) then: - notThrown(StorageErrorException) + notThrown(DataLakeStorageException) } def "Create file defaults"() { @@ -382,7 +382,7 @@ class FileSystemAPITest extends APISpec { Context.NONE) then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) } @Unroll @@ -483,7 +483,7 @@ class FileSystemAPITest extends APISpec { fsc.createFileWithResponse(pathName, null, null, null, null, drc, null, Context.NONE) then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -569,7 +569,7 @@ class FileSystemAPITest extends APISpec { fsc.deleteFileWithResponse(pathName, drc, null, null).getStatusCode() then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -586,7 +586,7 @@ class FileSystemAPITest extends APISpec { dir.create() then: - notThrown(StorageErrorException) + notThrown(DataLakeStorageException) } def "Create dir defaults"() { @@ -605,7 +605,7 @@ class FileSystemAPITest extends APISpec { Context.NONE) then: - thrown(Exception) + thrown(DataLakeStorageException) } @Unroll @@ -710,7 +710,7 @@ class FileSystemAPITest extends APISpec { fsc.createDirectoryWithResponse(pathName, null, null, null, null, drc, null, Context.NONE) then: - thrown(Exception) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -803,7 +803,7 @@ class FileSystemAPITest extends APISpec { fsc.deleteDirectoryWithResponse(pathName, false, drc, null, null).getStatusCode() then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/SASTest.groovy b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/SASTest.groovy index fe1e2e8789db..5b8cc6462e32 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/SASTest.groovy +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/SASTest.groovy @@ -11,6 +11,7 @@ import com.azure.storage.common.sas.* import com.azure.storage.file.datalake.implementation.models.StorageErrorException import com.azure.storage.file.datalake.models.DataLakeAccessPolicy import com.azure.storage.file.datalake.models.DataLakeSignedIdentifier +import com.azure.storage.file.datalake.models.DataLakeStorageException import com.azure.storage.file.datalake.models.FileRange import com.azure.storage.file.datalake.models.PathProperties import com.azure.storage.file.datalake.models.UserDelegationKey @@ -275,7 +276,7 @@ class SASTest extends APISpec { client.delete() then: - thrown(StorageErrorException) + thrown(DataLakeStorageException) } def "accountSAS network create file system fails"() { @@ -354,7 +355,7 @@ class SASTest extends APISpec { fc.create() then: - notThrown(Exception) + notThrown(DataLakeStorageException) } /* diff --git a/sdk/storage/azure-storage-file-datalake/swagger/README.md b/sdk/storage/azure-storage-file-datalake/swagger/README.md index 123efeb117d2..a04e654eb5d5 100644 --- a/sdk/storage/azure-storage-file-datalake/swagger/README.md +++ b/sdk/storage/azure-storage-file-datalake/swagger/README.md @@ -157,5 +157,47 @@ directive: return $.replace('@JsonProperty(value = "eTag")\n private String eTag;', '@JsonProperty(value = "etag")\n private String eTag;'); ``` +### Change StorageErrorException to StorageException +``` yaml +directive: +- from: ServicesImpl.java + where: $ + transform: > + return $. + replace( + "com.azure.storage.file.datalake.implementation.models.StorageErrorException", + "com.azure.storage.file.datalake.models.DataLakeStorageException" + ). + replace( + /\@UnexpectedResponseExceptionType\(StorageErrorException\.class\)/g, + "@UnexpectedResponseExceptionType(DataLakeStorageException.class)" + ); +- from: FileSystemsImpl.java + where: $ + transform: > + return $. + replace( + "com.azure.storage.file.datalake.implementation.models.StorageErrorException", + "com.azure.storage.file.datalake.models.DataLakeStorageException" + ). + replace( + /\@UnexpectedResponseExceptionType\(StorageErrorException\.class\)/g, + "@UnexpectedResponseExceptionType(DataLakeStorageException.class)" + ); +- from: PathsImpl.java + where: $ + transform: > + return $. + replace( + "com.azure.storage.file.datalake.implementation.models.StorageErrorException", + "com.azure.storage.file.datalake.models.DataLakeStorageException" + ). + replace( + /\@UnexpectedResponseExceptionType\(StorageErrorException\.class\)/g, + "@UnexpectedResponseExceptionType(DataLakeStorageException.class)" + ); +``` + + ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fstorage%2Fazure-storage-file-datalake%2Fswagger%2FREADME.png) From 7f65fc6845c423b15103975605a4394ba50549d6 Mon Sep 17 00:00:00 2001 From: Gauri Prasad Date: Tue, 10 Dec 2019 15:55:19 -0800 Subject: [PATCH 02/12] Adding error mapping for datalake --- .../datalake/DataLakeFileAsyncClient.java | 5 +- .../file/datalake/DataLakeFileClient.java | 14 +- .../DataLakeFileSystemAsyncClient.java | 12 +- .../datalake/DataLakeFileSystemClient.java | 59 +++++--- .../datalake/DataLakePathAsyncClient.java | 8 +- .../file/datalake/DataLakePathClient.java | 29 +++- .../datalake/DataLakeServiceAsyncClient.java | 10 +- .../file/datalake/DataLakeServiceClient.java | 25 +++- .../util/DataLakeImplUtils.java | 7 + .../DataLakeExceptionMappingPolicy.java | 41 ++++++ .../specialized/DataLakeLeaseAsyncClient.java | 17 ++- .../specialized/DataLakeLeaseClient.java | 42 +++++- .../storage/file/datalake/APISpec.groovy | 30 ++-- .../datalake/AsyncErrorMappingTest.groovy | 136 ++++++++++++++++++ .../file/datalake/DirectoryAPITest.groovy | 27 ++-- .../storage/file/datalake/FileAPITest.groovy | 24 ++-- .../file/datalake/FileSystemAPITest.groovy | 40 +++--- .../storage/file/datalake/SASTest.groovy | 15 +- .../file/datalake/ServiceAPITest.groovy | 4 +- .../datalake/specialized/LeaseAPITest.groovy | 54 +++---- .../LeaseAsyncErrorMappingTest.groovy | 69 +++++++++ ...AsyncErrorMappingTestcreatefilesystem.json | 127 ++++++++++++++++ ...AsyncErrorMappingTestdeletefilesystem.json | 127 ++++++++++++++++ ...rrorMappingTestgetdirectoryproperties.json | 124 ++++++++++++++++ ...syncErrorMappingTestgetfileproperties.json | 124 ++++++++++++++++ ...rorMappingTestgetfilesystemproperties.json | 127 ++++++++++++++++ .../AsyncErrorMappingTestreadfile.json | 127 ++++++++++++++++ ...MappingTestsetdirectoryhttpproperties.json | 127 ++++++++++++++++ ...cErrorMappingTestsetdirectorymetadata.json | 127 ++++++++++++++++ ...ErrorMappingTestsetfilehttpproperties.json | 127 ++++++++++++++++ .../AsyncErrorMappingTestsetfilemetadata.json | 127 ++++++++++++++++ ...ErrorMappingTestsetfilesystemmetadata.json | 127 ++++++++++++++++ ...easeAsyncErrorMappingTestacquirelease.json | 127 ++++++++++++++++ .../LeaseAsyncErrorMappingTestbreaklease.json | 127 ++++++++++++++++ ...LeaseAsyncErrorMappingTestchangelease.json | 127 ++++++++++++++++ ...easeAsyncErrorMappingTestreleaselease.json | 127 ++++++++++++++++ .../LeaseAsyncErrorMappingTestrenewlease.json | 127 ++++++++++++++++ 37 files changed, 2546 insertions(+), 148 deletions(-) create mode 100644 sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/models/DataLakeExceptionMappingPolicy.java create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/AsyncErrorMappingTest.groovy create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/specialized/LeaseAsyncErrorMappingTest.groovy create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestcreatefilesystem.json create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestdeletefilesystem.json create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestgetdirectoryproperties.json create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestgetfileproperties.json create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestgetfilesystemproperties.json create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestreadfile.json create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestsetdirectoryhttpproperties.json create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestsetdirectorymetadata.json create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestsetfilehttpproperties.json create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestsetfilemetadata.json create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestsetfilesystemmetadata.json create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/LeaseAsyncErrorMappingTestacquirelease.json create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/LeaseAsyncErrorMappingTestbreaklease.json create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/LeaseAsyncErrorMappingTestchangelease.json create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/LeaseAsyncErrorMappingTestreleaselease.json create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/LeaseAsyncErrorMappingTestrenewlease.json diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileAsyncClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileAsyncClient.java index b79e14b636ca..ac22d9f76c96 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileAsyncClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileAsyncClient.java @@ -11,10 +11,12 @@ import com.azure.core.util.FluxUtil; import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.BlobContainerAsyncClient; +import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.blob.specialized.BlockBlobAsyncClient; import com.azure.storage.file.datalake.implementation.models.LeaseAccessConditions; import com.azure.storage.file.datalake.implementation.models.ModifiedAccessConditions; import com.azure.storage.file.datalake.implementation.models.PathResourceType; +import com.azure.storage.file.datalake.implementation.util.DataLakeImplUtils; import com.azure.storage.file.datalake.models.DataLakeRequestConditions; import com.azure.storage.file.datalake.models.DownloadRetryOptions; import com.azure.storage.file.datalake.models.FileRange; @@ -328,7 +330,8 @@ public Mono readWithResponse(FileRange range, DownloadRet try { return blockBlobAsyncClient.downloadWithResponse(Transforms.toBlobRange(range), Transforms.toBlobDownloadRetryOptions(options), Transforms.toBlobRequestConditions(requestConditions), - getRangeContentMd5).map(Transforms::toFileReadAsyncResponse); + getRangeContentMd5).map(Transforms::toFileReadAsyncResponse) + .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)); } catch (RuntimeException ex) { return monoError(logger, ex); } diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileClient.java index e8520efbba9f..842d16169e63 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileClient.java @@ -9,9 +9,11 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.BlobAsyncClient; import com.azure.storage.blob.models.BlobDownloadResponse; +import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.blob.specialized.BlockBlobClient; import com.azure.storage.common.Utility; import com.azure.storage.common.implementation.StorageImplUtils; +import com.azure.storage.file.datalake.implementation.util.DataLakeImplUtils; import com.azure.storage.file.datalake.models.DataLakeRequestConditions; import com.azure.storage.file.datalake.models.DownloadRetryOptions; import com.azure.storage.file.datalake.models.FileRange; @@ -276,10 +278,14 @@ public void read(OutputStream stream) { */ public FileReadResponse readWithResponse(OutputStream stream, FileRange range, DownloadRetryOptions options, DataLakeRequestConditions requestConditions, boolean getRangeContentMd5, Duration timeout, Context context) { - BlobDownloadResponse response = blockBlobClient.downloadWithResponse(stream, Transforms.toBlobRange(range), - Transforms.toBlobDownloadRetryOptions(options), Transforms.toBlobRequestConditions(requestConditions), - getRangeContentMd5, timeout, context); - return Transforms.toFileReadResponse(response); + try { + BlobDownloadResponse response = blockBlobClient.downloadWithResponse(stream, Transforms.toBlobRange(range), + Transforms.toBlobDownloadRetryOptions(options), Transforms.toBlobRequestConditions(requestConditions), + getRangeContentMd5, timeout, context); + return Transforms.toFileReadResponse(response); + } catch (BlobStorageException ex) { + throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); + } } /** diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemAsyncClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemAsyncClient.java index 03085cd85008..5ec434991819 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemAsyncClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemAsyncClient.java @@ -14,6 +14,7 @@ import com.azure.core.util.FluxUtil; import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.BlobContainerAsyncClient; +import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.blob.specialized.BlockBlobAsyncClient; import com.azure.storage.common.StorageSharedKeyCredential; import com.azure.storage.common.Utility; @@ -22,6 +23,7 @@ import com.azure.storage.file.datalake.implementation.DataLakeStorageClientImpl; import com.azure.storage.file.datalake.implementation.models.FileSystemsListPathsResponse; import com.azure.storage.file.datalake.implementation.models.Path; +import com.azure.storage.file.datalake.implementation.util.DataLakeImplUtils; import com.azure.storage.file.datalake.models.DataLakeRequestConditions; import com.azure.storage.file.datalake.models.DataLakeSignedIdentifier; import com.azure.storage.file.datalake.models.FileSystemAccessPolicies; @@ -241,7 +243,8 @@ public Mono create() { */ public Mono> createWithResponse(Map metadata, PublicAccessType accessType) { try { - return blobContainerAsyncClient.createWithResponse(metadata, Transforms.toBlobPublicAccessType(accessType)); + return blobContainerAsyncClient.createWithResponse(metadata, Transforms.toBlobPublicAccessType(accessType)) + .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)); } catch (RuntimeException ex) { return monoError(logger, ex); } @@ -283,7 +286,8 @@ public Mono delete() { public Mono> deleteWithResponse(DataLakeRequestConditions requestConditions) { try { return blobContainerAsyncClient.deleteWithResponse( - Transforms.toBlobRequestConditions(requestConditions)); + Transforms.toBlobRequestConditions(requestConditions)) + .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)); } catch (RuntimeException ex) { return monoError(logger, ex); } @@ -322,6 +326,7 @@ public Mono getProperties() { public Mono> getPropertiesWithResponse(String leaseId) { try { return blobContainerAsyncClient.getPropertiesWithResponse(leaseId) + .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)) .map(response -> new SimpleResponse<>(response, Transforms.toFileSystemProperties(response.getValue()))); } catch (RuntimeException ex) { @@ -368,7 +373,8 @@ public Mono> setMetadataWithResponse(Map metadata DataLakeRequestConditions requestConditions) { try { return blobContainerAsyncClient.setMetadataWithResponse(metadata, - Transforms.toBlobRequestConditions(requestConditions)); + Transforms.toBlobRequestConditions(requestConditions)) + .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)); } catch (RuntimeException ex) { return monoError(logger, ex); } diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemClient.java index 42a4c478c66f..43b004594601 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemClient.java @@ -13,7 +13,9 @@ import com.azure.storage.blob.BlobContainerClient; import com.azure.storage.blob.models.BlobContainerAccessPolicies; import com.azure.storage.blob.models.BlobContainerProperties; +import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.common.StorageSharedKeyCredential; +import com.azure.storage.file.datalake.implementation.util.DataLakeImplUtils; import com.azure.storage.file.datalake.models.DataLakeRequestConditions; import com.azure.storage.file.datalake.models.DataLakeSignedIdentifier; import com.azure.storage.file.datalake.models.FileSystemAccessPolicies; @@ -195,8 +197,13 @@ public void create() { */ public Response createWithResponse(Map metadata, PublicAccessType accessType, Duration timeout, Context context) { - return blobContainerClient.createWithResponse(metadata, Transforms.toBlobPublicAccessType(accessType), timeout, - context); + try { + return blobContainerClient.createWithResponse(metadata, Transforms.toBlobPublicAccessType(accessType), timeout, + context); + } catch (BlobStorageException ex) { + throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); + } + } /** @@ -228,8 +235,12 @@ public void delete() { */ public Response deleteWithResponse(DataLakeRequestConditions requestConditions, Duration timeout, Context context) { - return blobContainerClient.deleteWithResponse(Transforms.toBlobRequestConditions(requestConditions), - timeout, context); + try { + return blobContainerClient.deleteWithResponse(Transforms.toBlobRequestConditions(requestConditions), + timeout, context); + } catch (BlobStorageException ex) { + throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); + } } /** @@ -260,9 +271,13 @@ public FileSystemProperties getProperties() { * @return A response containing the file system properties. */ public Response getPropertiesWithResponse(String leaseId, Duration timeout, Context context) { - Response response = blobContainerClient.getPropertiesWithResponse(leaseId, timeout, - context); - return new SimpleResponse<>(response, Transforms.toFileSystemProperties(response.getValue())); + try { + Response response = blobContainerClient.getPropertiesWithResponse(leaseId, timeout, + context); + return new SimpleResponse<>(response, Transforms.toFileSystemProperties(response.getValue())); + } catch (BlobStorageException ex) { + throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); + } } /** @@ -294,8 +309,12 @@ public void setMetadata(Map metadata) { */ public Response setMetadataWithResponse(Map metadata, DataLakeRequestConditions requestConditions, Duration timeout, Context context) { - return blobContainerClient.setMetadataWithResponse(metadata, - Transforms.toBlobRequestConditions(requestConditions), timeout, context); + try { + return blobContainerClient.setMetadataWithResponse(metadata, + Transforms.toBlobRequestConditions(requestConditions), timeout, context); + } catch (BlobStorageException ex) { + throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); + } } /** @@ -523,9 +542,13 @@ public FileSystemAccessPolicies getAccessPolicy() { */ public Response getAccessPolicyWithResponse(String leaseId, Duration timeout, Context context) { - Response response = blobContainerClient.getAccessPolicyWithResponse(leaseId, - timeout, context); - return new SimpleResponse<>(response, Transforms.toFileSystemAccessPolicies(response.getValue())); + try { + Response response = blobContainerClient.getAccessPolicyWithResponse(leaseId, + timeout, context); + return new SimpleResponse<>(response, Transforms.toFileSystemAccessPolicies(response.getValue())); + } catch (BlobStorageException ex) { + throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); + } } /** @@ -575,10 +598,14 @@ public void setAccessPolicy(PublicAccessType accessType, List setAccessPolicyWithResponse(PublicAccessType accessType, List identifiers, DataLakeRequestConditions requestConditions, Duration timeout, Context context) { - return blobContainerClient - .setAccessPolicyWithResponse(Transforms.toBlobPublicAccessType(accessType), - Transforms.toBlobIdentifierList(identifiers), Transforms.toBlobRequestConditions(requestConditions), - timeout, context); + try { + return blobContainerClient + .setAccessPolicyWithResponse(Transforms.toBlobPublicAccessType(accessType), + Transforms.toBlobIdentifierList(identifiers), Transforms.toBlobRequestConditions(requestConditions), + timeout, context); + } catch (BlobStorageException ex) { + throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); + } } BlobContainerClient getBlobContainerClient() { 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..ab8b3207db98 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 @@ -13,6 +13,7 @@ import com.azure.storage.blob.BlobContainerAsyncClient; import com.azure.storage.blob.BlobServiceVersion; import com.azure.storage.blob.BlobUrlParts; +import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.blob.specialized.BlockBlobAsyncClient; import com.azure.storage.blob.specialized.SpecializedBlobClientBuilder; import com.azure.storage.common.StorageSharedKeyCredential; @@ -324,7 +325,8 @@ public Mono> setMetadataWithResponse(Map metadata DataLakeRequestConditions requestConditions) { try { return this.blockBlobAsyncClient.setMetadataWithResponse(metadata, - Transforms.toBlobRequestConditions(requestConditions)); + Transforms.toBlobRequestConditions(requestConditions)) + .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)); } catch (RuntimeException ex) { return monoError(logger, ex); } @@ -371,7 +373,8 @@ public Mono> setHttpHeadersWithResponse(PathHttpHeaders headers, DataLakeRequestConditions requestConditions) { try { return this.blockBlobAsyncClient.setHttpHeadersWithResponse(Transforms.toBlobHttpHeaders(headers), - Transforms.toBlobRequestConditions(requestConditions)); + Transforms.toBlobRequestConditions(requestConditions)) + .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)); } catch (RuntimeException ex) { return monoError(logger, ex); } @@ -413,6 +416,7 @@ public Mono getProperties() { public Mono> getPropertiesWithResponse(DataLakeRequestConditions requestConditions) { try { return blockBlobAsyncClient.getPropertiesWithResponse(Transforms.toBlobRequestConditions(requestConditions)) + .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)) .map(response -> new SimpleResponse<>(response, Transforms.toPathProperties(response.getValue()))); } catch (RuntimeException ex) { return monoError(logger, ex); 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..2452363f9e91 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 @@ -9,6 +9,7 @@ import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.models.BlobProperties; +import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.blob.specialized.BlockBlobClient; import com.azure.storage.common.StorageSharedKeyCredential; import com.azure.storage.common.implementation.StorageImplUtils; @@ -16,7 +17,9 @@ import com.azure.storage.file.datalake.implementation.models.ModifiedAccessConditions; import com.azure.storage.file.datalake.implementation.models.PathRenameMode; import com.azure.storage.file.datalake.implementation.models.SourceModifiedAccessConditions; +import com.azure.storage.file.datalake.implementation.util.DataLakeImplUtils; import com.azure.storage.file.datalake.models.DataLakeRequestConditions; +import com.azure.storage.file.datalake.models.DataLakeStorageException; import com.azure.storage.file.datalake.models.PathAccessControl; import com.azure.storage.file.datalake.models.PathAccessControlEntry; import com.azure.storage.file.datalake.models.PathHttpHeaders; @@ -192,8 +195,12 @@ public void setMetadata(Map metadata) { */ public Response setMetadataWithResponse(Map metadata, DataLakeRequestConditions requestConditions, Duration timeout, Context context) { - return blockBlobClient.setMetadataWithResponse(metadata, Transforms.toBlobRequestConditions(requestConditions), - timeout, context); + try { + return blockBlobClient.setMetadataWithResponse(metadata, + Transforms.toBlobRequestConditions(requestConditions), timeout, context); + } catch (BlobStorageException ex) { + throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); + } } /** @@ -232,8 +239,12 @@ public void setHttpHeaders(PathHttpHeaders headers) { */ public Response setHttpHeadersWithResponse(PathHttpHeaders headers, DataLakeRequestConditions requestConditions, Duration timeout, Context context) { - return blockBlobClient.setHttpHeadersWithResponse(Transforms.toBlobHttpHeaders(headers), - Transforms.toBlobRequestConditions(requestConditions), timeout, context); + try { + return blockBlobClient.setHttpHeadersWithResponse(Transforms.toBlobHttpHeaders(headers), + Transforms.toBlobRequestConditions(requestConditions), timeout, context); + } catch (BlobStorageException ex) { + throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); + } } /** @@ -400,9 +411,13 @@ public PathProperties getProperties() { */ public Response getPropertiesWithResponse(DataLakeRequestConditions requestConditions, Duration timeout, Context context) { - Response response = blockBlobClient.getPropertiesWithResponse( - Transforms.toBlobRequestConditions(requestConditions), timeout, context); - return new SimpleResponse<>(response, Transforms.toPathProperties(response.getValue())); + try { + Response response = blockBlobClient.getPropertiesWithResponse( + Transforms.toBlobRequestConditions(requestConditions), timeout, context); + return new SimpleResponse<>(response, Transforms.toPathProperties(response.getValue())); + } catch (BlobStorageException ex) { + throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); + } } /** diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceAsyncClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceAsyncClient.java index 0ec038cdeacf..2e89bac34ede 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceAsyncClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceAsyncClient.java @@ -13,12 +13,14 @@ import com.azure.core.util.FluxUtil; import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.BlobServiceAsyncClient; +import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.common.StorageSharedKeyCredential; import com.azure.storage.common.Utility; import com.azure.storage.common.implementation.StorageImplUtils; import com.azure.storage.common.sas.AccountSasSignatureValues; import com.azure.storage.file.datalake.implementation.DataLakeStorageClientBuilder; import com.azure.storage.file.datalake.implementation.DataLakeStorageClientImpl; +import com.azure.storage.file.datalake.implementation.util.DataLakeImplUtils; import com.azure.storage.file.datalake.models.DataLakeRequestConditions; import com.azure.storage.file.datalake.models.FileSystemItem; import com.azure.storage.file.datalake.models.ListFileSystemsOptions; @@ -256,6 +258,7 @@ public PagedFlux listFileSystems() { public PagedFlux listFileSystems(ListFileSystemsOptions options) { try { return blobServiceAsyncClient.listBlobContainers(Transforms.toListBlobContainersOptions(options)) +// .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)) .mapPage(Transforms::toFileSystemItem); } catch (RuntimeException ex) { return pagedFluxError(logger, ex); @@ -278,8 +281,7 @@ public PagedFlux listFileSystems(ListFileSystemsOptions options) */ public Mono getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry) { try { - return blobServiceAsyncClient.getUserDelegationKey(start, expiry) - .map(Transforms::toDataLakeUserDelegationKey); + return this.getUserDelegationKeyWithResponse(start, expiry).flatMap(FluxUtil::toMono); } catch (RuntimeException ex) { return monoError(logger, ex); } @@ -303,7 +305,9 @@ public Mono getUserDelegationKey(OffsetDateTime start, Offset public Mono> getUserDelegationKeyWithResponse(OffsetDateTime start, OffsetDateTime expiry) { try { - return blobServiceAsyncClient.getUserDelegationKeyWithResponse(start, expiry).map(response -> + return blobServiceAsyncClient.getUserDelegationKeyWithResponse(start, expiry) + .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)) + .map(response -> new SimpleResponse<>(response, Transforms.toDataLakeUserDelegationKey(response.getValue()))); } catch (RuntimeException ex) { return monoError(logger, ex); diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceClient.java index e07192712210..a73a2df9d0e8 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceClient.java @@ -10,9 +10,13 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.BlobServiceClient; +import com.azure.storage.blob.models.BlobContainerItem; +import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.common.StorageSharedKeyCredential; import com.azure.storage.common.sas.AccountSasSignatureValues; +import com.azure.storage.file.datalake.implementation.util.DataLakeImplUtils; import com.azure.storage.file.datalake.models.DataLakeRequestConditions; import com.azure.storage.file.datalake.models.FileSystemItem; import com.azure.storage.file.datalake.models.ListFileSystemsOptions; @@ -23,6 +27,7 @@ import java.time.OffsetDateTime; import java.util.Map; + /** * Client to a storage account. It may only be instantiated through a {@link DataLakeServiceClientBuilder}. This class * does not hold any state about a particular storage account but is instead a convenient way of sending off appropriate @@ -37,6 +42,7 @@ @ServiceClient(builder = DataLakeServiceClientBuilder.class) public class DataLakeServiceClient { + private final ClientLogger logger = new ClientLogger(DataLakeServiceClient.class); private final DataLakeServiceAsyncClient dataLakeServiceAsyncClient; private final BlobServiceClient blobServiceClient; @@ -169,7 +175,6 @@ public String getAccountUrl() { return dataLakeServiceAsyncClient.getAccountUrl(); } - // TODO (gapra) : Change return type /** * Returns a lazy loaded list of file systems in this account. The returned {@link PagedIterable} can be consumed * while new items are automatically retrieved as needed. For more information, see the listFileSystems() { * @return The list of file systems. */ public PagedIterable listFileSystems(ListFileSystemsOptions options, Duration timeout) { - return blobServiceClient.listBlobContainers(Transforms.toListBlobContainersOptions(options), timeout) - .mapPage(Transforms::toFileSystemItem); + try { + return blobServiceClient.listBlobContainers(Transforms.toListBlobContainersOptions(options), timeout) + .mapPage(Transforms::toFileSystemItem); + } catch (BlobStorageException ex) { + throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); + } } /** @@ -235,9 +244,13 @@ public UserDelegationKey getUserDelegationKey(OffsetDateTime start, OffsetDateTi */ public Response getUserDelegationKeyWithResponse(OffsetDateTime start, OffsetDateTime expiry, Duration timeout, Context context) { - Response response = blobServiceClient - .getUserDelegationKeyWithResponse(start, expiry, timeout, context); - return new SimpleResponse<>(response, Transforms.toDataLakeUserDelegationKey(response.getValue())); + try { + Response response = blobServiceClient + .getUserDelegationKeyWithResponse(start, expiry, timeout, context); + return new SimpleResponse<>(response, Transforms.toDataLakeUserDelegationKey(response.getValue())); + } catch (BlobStorageException ex) { + throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); + } } /** diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/DataLakeImplUtils.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/DataLakeImplUtils.java index de20b93e20b8..d78940449e01 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/DataLakeImplUtils.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/DataLakeImplUtils.java @@ -3,6 +3,9 @@ package com.azure.storage.file.datalake.implementation.util; +import com.azure.storage.blob.models.BlobStorageException; +import com.azure.storage.file.datalake.models.DataLakeStorageException; + public class DataLakeImplUtils { public static String endpointToDesiredEndpoint(String endpoint, String desiredEndpoint, String currentEndpoint) { // Add the . on either side to prevent overwriting an endpoint if a user provides a @@ -14,4 +17,8 @@ public static String endpointToDesiredEndpoint(String endpoint, String desiredEn return endpoint.replaceFirst(currentStringToMatch, desiredStringToMatch); } } + + public static DataLakeStorageException transformBlobStorageException(BlobStorageException ex) { + return new DataLakeStorageException(ex.getServiceMessage(), ex.getResponse(), ex.getValue()); + } } diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/models/DataLakeExceptionMappingPolicy.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/models/DataLakeExceptionMappingPolicy.java new file mode 100644 index 000000000000..a6e77f35aaa0 --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/models/DataLakeExceptionMappingPolicy.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file.datalake.models; + +import com.azure.core.http.HttpPipelineCallContext; +import com.azure.core.http.HttpPipelineNextPolicy; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.storage.blob.models.BlobStorageException; +import reactor.core.publisher.Mono; + +/** + * This is an exception mapping policy in an HttpPipeline to map BlobStorageExceptions to DataLakeStorageExceptions. + */ +public class DataLakeExceptionMappingPolicy implements HttpPipelinePolicy { + + @Override + public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { + return next.process().onErrorMap(DataLakeExceptionMappingPolicy::transformBlobStorageException); + + } + + /*p + * Remaps the exception returned from a BlobStorageException to a DataLakeStorageException + * + * @param throwable BlobStorageException. + * + * @return Exception remapped to a DataLakeStorageException if the throwable was a BlobStorageException, + * otherwise the throwable is returned unmodified. + */ + private static Throwable transformBlobStorageException(Throwable throwable) { + if (!(throwable instanceof BlobStorageException)) { + return throwable; + } + + BlobStorageException blobStorageException = (BlobStorageException) throwable; + return new DataLakeStorageException(blobStorageException.getServiceMessage(), + blobStorageException.getResponse(), blobStorageException.getValue()); + } +} diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/specialized/DataLakeLeaseAsyncClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/specialized/DataLakeLeaseAsyncClient.java index f60f69701eac..f599d0f6305d 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/specialized/DataLakeLeaseAsyncClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/specialized/DataLakeLeaseAsyncClient.java @@ -9,10 +9,12 @@ import com.azure.core.http.RequestConditions; import com.azure.core.http.rest.Response; import com.azure.core.util.FluxUtil; +import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.blob.specialized.BlobLeaseAsyncClient; import com.azure.storage.file.datalake.DataLakeDirectoryAsyncClient; import com.azure.storage.file.datalake.DataLakeFileAsyncClient; import com.azure.storage.file.datalake.DataLakeFileSystemAsyncClient; +import com.azure.storage.file.datalake.implementation.util.DataLakeImplUtils; import reactor.core.publisher.Mono; import java.net.URL; @@ -101,7 +103,8 @@ public Mono acquireLease(int duration) { @ServiceMethod(returns = ReturnType.SINGLE) public Mono> acquireLeaseWithResponse(int duration, RequestConditions modifiedRequestConditions) { - return this.blobLeaseAsyncClient.acquireLeaseWithResponse(duration, modifiedRequestConditions); + return this.blobLeaseAsyncClient.acquireLeaseWithResponse(duration, modifiedRequestConditions) + .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)); } /** @@ -132,7 +135,8 @@ public Mono renewLease() { */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> renewLeaseWithResponse(RequestConditions modifiedRequestConditions) { - return blobLeaseAsyncClient.renewLeaseWithResponse(modifiedRequestConditions); + return blobLeaseAsyncClient.renewLeaseWithResponse(modifiedRequestConditions) + .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)); } /** @@ -163,7 +167,8 @@ public Mono releaseLease() { */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> releaseLeaseWithResponse(RequestConditions modifiedRequestConditions) { - return blobLeaseAsyncClient.releaseLeaseWithResponse(modifiedRequestConditions); + return blobLeaseAsyncClient.releaseLeaseWithResponse(modifiedRequestConditions) + .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)); } /** @@ -202,7 +207,8 @@ public Mono breakLease() { @ServiceMethod(returns = ReturnType.SINGLE) public Mono> breakLeaseWithResponse(Integer breakPeriodInSeconds, RequestConditions modifiedRequestConditions) { - return blobLeaseAsyncClient.breakLeaseWithResponse(breakPeriodInSeconds, modifiedRequestConditions); + return blobLeaseAsyncClient.breakLeaseWithResponse(breakPeriodInSeconds, modifiedRequestConditions) + .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)); } /** @@ -236,7 +242,8 @@ public Mono changeLease(String proposedId) { @ServiceMethod(returns = ReturnType.SINGLE) public Mono> changeLeaseWithResponse(String proposedId, RequestConditions modifiedRequestConditions) { - return blobLeaseAsyncClient.changeLeaseWithResponse(proposedId, modifiedRequestConditions); + return blobLeaseAsyncClient.changeLeaseWithResponse(proposedId, modifiedRequestConditions) + .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)); } /** diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/specialized/DataLakeLeaseClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/specialized/DataLakeLeaseClient.java index 37f9d3a41cc8..09d7ba366753 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/specialized/DataLakeLeaseClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/specialized/DataLakeLeaseClient.java @@ -9,9 +9,12 @@ import com.azure.core.http.RequestConditions; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.blob.specialized.BlobLeaseClient; import com.azure.storage.file.datalake.DataLakeFileSystemClient; import com.azure.storage.file.datalake.DataLakePathClient; +import com.azure.storage.file.datalake.models.DataLakeStorageException; import java.net.URL; import java.time.Duration; @@ -39,6 +42,8 @@ */ @ServiceClient(builder = DataLakeLeaseClientBuilder.class) public final class DataLakeLeaseClient { + + private final ClientLogger logger = new ClientLogger(DataLakeLeaseClient.class); private final BlobLeaseClient blobLeaseClient; DataLakeLeaseClient(BlobLeaseClient blobLeaseClient) { @@ -100,7 +105,12 @@ public String acquireLease(int duration) { @ServiceMethod(returns = ReturnType.SINGLE) public Response acquireLeaseWithResponse(int duration, RequestConditions modifiedRequestConditions, Duration timeout, Context context) { - return blobLeaseClient.acquireLeaseWithResponse(duration, modifiedRequestConditions, timeout, context); + try { + return blobLeaseClient.acquireLeaseWithResponse(duration, modifiedRequestConditions, timeout, context); + } catch (BlobStorageException ex) { + throw logger.logExceptionAsError(new DataLakeStorageException(ex.getServiceMessage(), ex.getResponse(), + ex.getValue())); + } } /** @@ -134,7 +144,12 @@ public String renewLease() { @ServiceMethod(returns = ReturnType.SINGLE) public Response renewLeaseWithResponse(RequestConditions modifiedRequestConditions, Duration timeout, Context context) { - return blobLeaseClient.renewLeaseWithResponse(modifiedRequestConditions, timeout, context); + try { + return blobLeaseClient.renewLeaseWithResponse(modifiedRequestConditions, timeout, context); + } catch (BlobStorageException ex) { + throw logger.logExceptionAsError(new DataLakeStorageException(ex.getServiceMessage(), ex.getResponse(), + ex.getValue())); + } } /** @@ -166,7 +181,12 @@ public void releaseLease() { @ServiceMethod(returns = ReturnType.SINGLE) public Response releaseLeaseWithResponse(RequestConditions modifiedRequestConditions, Duration timeout, Context context) { - return blobLeaseClient.releaseLeaseWithResponse(modifiedRequestConditions, timeout, context); + try { + return blobLeaseClient.releaseLeaseWithResponse(modifiedRequestConditions, timeout, context); + } catch (BlobStorageException ex) { + throw logger.logExceptionAsError(new DataLakeStorageException(ex.getServiceMessage(), ex.getResponse(), + ex.getValue())); + } } /** @@ -207,8 +227,13 @@ public Integer breakLease() { @ServiceMethod(returns = ReturnType.SINGLE) public Response breakLeaseWithResponse(Integer breakPeriodInSeconds, RequestConditions modifiedRequestConditions, Duration timeout, Context context) { - return blobLeaseClient.breakLeaseWithResponse(breakPeriodInSeconds, modifiedRequestConditions, timeout, - context); + try { + return blobLeaseClient.breakLeaseWithResponse(breakPeriodInSeconds, modifiedRequestConditions, timeout, + context); + } catch (BlobStorageException ex) { + throw logger.logExceptionAsError(new DataLakeStorageException(ex.getServiceMessage(), ex.getResponse(), + ex.getValue())); + } } /** @@ -244,7 +269,12 @@ public String changeLease(String proposedId) { @ServiceMethod(returns = ReturnType.SINGLE) public Response changeLeaseWithResponse(String proposedId, RequestConditions modifiedRequestConditions, Duration timeout, Context context) { - return blobLeaseClient.changeLeaseWithResponse(proposedId, modifiedRequestConditions, timeout, context); + try { + return blobLeaseClient.changeLeaseWithResponse(proposedId, modifiedRequestConditions, timeout, context); + } catch (BlobStorageException ex) { + throw logger.logExceptionAsError(new DataLakeStorageException(ex.getServiceMessage(), ex.getResponse(), + ex.getValue())); + } } /** diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/APISpec.groovy b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/APISpec.groovy index 58a1eae4638f..4b69f663d6ce 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/APISpec.groovy +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/APISpec.groovy @@ -15,6 +15,7 @@ import com.azure.core.util.logging.ClientLogger import com.azure.identity.EnvironmentCredentialBuilder import com.azure.storage.common.StorageSharedKeyCredential import com.azure.storage.file.datalake.models.* +import com.azure.storage.file.datalake.specialized.DataLakeLeaseAsyncClient import com.azure.storage.file.datalake.specialized.DataLakeLeaseClient import com.azure.storage.file.datalake.specialized.DataLakeLeaseClientBuilder import reactor.core.publisher.Flux @@ -163,15 +164,15 @@ class APISpec extends Specification { } static TestMode setupTestMode() { -// String testMode = Configuration.getGlobalConfiguration().get(AZURE_TEST_MODE) -// -// if (testMode != null) { -// try { -// return TestMode.valueOf(testMode.toUpperCase(Locale.US)) -// } catch (IllegalArgumentException ignore) { -// return TestMode.PLAYBACK -// } -// } + String testMode = Configuration.getGlobalConfiguration().get(AZURE_TEST_MODE) + + if (testMode != null) { + try { + return TestMode.valueOf(testMode.toUpperCase(Locale.US)) + } catch (IllegalArgumentException ignore) { + return TestMode.PLAYBACK + } + } return TestMode.PLAYBACK } @@ -300,6 +301,17 @@ class APISpec extends Specification { .buildClient() } + static DataLakeLeaseAsyncClient createLeaseAsyncClient(DataLakeFileAsyncClient pathAsyncClient) { + return createLeaseAsyncClient(pathAsyncClient, null) + } + + static DataLakeLeaseAsyncClient createLeaseAsyncClient(DataLakeFileAsyncClient pathAsyncClient, String leaseId) { + return new DataLakeLeaseClientBuilder() + .fileAsyncClient(pathAsyncClient) + .leaseId(leaseId) + .buildAsyncClient() + } + static DataLakeLeaseClient createLeaseClient(DataLakeDirectoryClient pathClient) { return createLeaseClient(pathClient, null) } diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/AsyncErrorMappingTest.groovy b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/AsyncErrorMappingTest.groovy new file mode 100644 index 000000000000..17447e6d84d6 --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/AsyncErrorMappingTest.groovy @@ -0,0 +1,136 @@ +package com.azure.storage.file.datalake + +import com.azure.storage.file.datalake.models.DataLakeStorageException +import reactor.test.StepVerifier + +class AsyncErrorMappingTest extends APISpec { + + DataLakeFileSystemAsyncClient fsac + String fileSystemName + + def setup() { + fileSystemName = generateFileSystemName() + fsac = getServiceAsyncClient(primaryCredential).createFileSystem(fileSystemName).block() + } + + def "Read file"() { + when: + def fileName = generatePathName() + def fac = fsac.getFileAsyncClient(fileName) + def readFileVerifier = StepVerifier.create(fac.readWithResponse(null, null, null, false)) + then: + readFileVerifier.verifyErrorSatisfies { + assert it instanceof DataLakeStorageException + } + } + + def "Get file properties"() { + when: + def fileName = generatePathName() + def fac = fsac.getFileAsyncClient(fileName) + def getPropertiesVerifier = StepVerifier.create(fac.getPropertiesWithResponse(null)) + then: + getPropertiesVerifier.verifyErrorSatisfies { + assert it instanceof DataLakeStorageException + } + } + + def "Set file http properties"() { + when: + def fileName = generatePathName() + def fac = fsac.getFileAsyncClient(fileName) + def setPropertiesVerifier = StepVerifier.create(fac.setHttpHeadersWithResponse(null, null)) + then: + setPropertiesVerifier.verifyErrorSatisfies { + assert it instanceof DataLakeStorageException + } + } + + def "Set file metadata"() { + when: + def fileName = generatePathName() + def fac = fsac.getFileAsyncClient(fileName) + def setMetadataVerifier = StepVerifier.create(fac.setMetadataWithResponse(null, null)) + then: + setMetadataVerifier.verifyErrorSatisfies { + assert it instanceof DataLakeStorageException + } + } + + def "Get directory properties"() { + when: + def directoryName = generatePathName() + def dac = fsac.getDirectoryAsyncClient(directoryName) + def getPropertiesVerifier = StepVerifier.create(dac.getPropertiesWithResponse(null)) + then: + getPropertiesVerifier.verifyErrorSatisfies { + assert it instanceof DataLakeStorageException + } + } + + def "Set directory http properties"() { + when: + def directoryName = generatePathName() + def dac = fsac.getDirectoryAsyncClient(directoryName) + def setPropertiesVerifier = StepVerifier.create(dac.setHttpHeadersWithResponse(null, null)) + then: + setPropertiesVerifier.verifyErrorSatisfies { + assert it instanceof DataLakeStorageException + } + } + + def "Set directory metadata"() { + when: + def directoryName = generatePathName() + def dac = fsac.getDirectoryAsyncClient(directoryName) + def setMetadataVerifier = StepVerifier.create(dac.setMetadataWithResponse(null, null)) + then: + setMetadataVerifier.verifyErrorSatisfies { + assert it instanceof DataLakeStorageException + } + } + + def "Create file system"() { + when: + def fsac = getServiceAsyncClient(primaryCredential).getFileSystemAsyncClient(fileSystemName) + def createVerifier = StepVerifier.create(fsac.createWithResponse(null, null)) + then: + createVerifier.verifyErrorSatisfies { + assert it instanceof DataLakeStorageException + } + } + + def "Get file system properties"() { + when: + def fileSystemName = generateFileSystemName() + def fsac = getServiceAsyncClient(primaryCredential).getFileSystemAsyncClient(fileSystemName) + def getPropertiesVerifier = StepVerifier.create(fsac.getPropertiesWithResponse(null)) + then: + getPropertiesVerifier.verifyErrorSatisfies { + assert it instanceof DataLakeStorageException + } + } + + def "Set file system metadata"() { + when: + def fileSystemName = generateFileSystemName() + def fsac = getServiceAsyncClient(primaryCredential).getFileSystemAsyncClient(fileSystemName) + def setMetadataVerifier = StepVerifier.create(fsac.setMetadataWithResponse(null, null)) + then: + setMetadataVerifier.verifyErrorSatisfies { + assert it instanceof DataLakeStorageException + } + } + + def "Delete file system"() { + when: + def fileSystemName = generateFileSystemName() + def fsac = getServiceAsyncClient(primaryCredential).getFileSystemAsyncClient(fileSystemName) + def setMetadataVerifier = StepVerifier.create(fsac.deleteWithResponse(null)) + then: + setMetadataVerifier.verifyErrorSatisfies { + assert it instanceof DataLakeStorageException + } + } + +} 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 607e4e6f5223..980147efd418 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 @@ -5,7 +5,6 @@ import com.azure.core.util.Context import com.azure.identity.DefaultAzureCredentialBuilder import com.azure.storage.blob.BlobUrlParts import com.azure.storage.blob.models.BlobErrorCode -import com.azure.storage.blob.models.BlobStorageException import com.azure.storage.file.datalake.implementation.models.StorageErrorException import com.azure.storage.file.datalake.models.* @@ -196,9 +195,9 @@ class DirectoryAPITest extends APISpec { dc.getPropertiesWithResponse(null, null, null) then: - def e = thrown(BlobStorageException) + def e = thrown(DataLakeStorageException) e.getResponse().getStatusCode() == 404 - e.getErrorCode() == BlobErrorCode.BLOB_NOT_FOUND + e.getErrorCode() == BlobErrorCode.BLOB_NOT_FOUND.toString() // e.getServiceMessage().contains("The specified blob does not exist.") } @@ -504,7 +503,7 @@ class DirectoryAPITest extends APISpec { dc.getProperties() then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } def "Rename error"() { @@ -708,7 +707,7 @@ class DirectoryAPITest extends APISpec { dc.getPropertiesWithResponse(drc, null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -727,7 +726,7 @@ class DirectoryAPITest extends APISpec { dc.getProperties() then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } def "Set HTTP headers null"() { @@ -820,7 +819,7 @@ class DirectoryAPITest extends APISpec { dc.setHttpHeadersWithResponse(null, drc, null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -839,7 +838,7 @@ class DirectoryAPITest extends APISpec { dc.setHttpHeaders(null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } def "Set metadata all null"() { @@ -937,7 +936,7 @@ class DirectoryAPITest extends APISpec { dc.setMetadataWithResponse(null, drc, null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -956,7 +955,7 @@ class DirectoryAPITest extends APISpec { dc.setMetadata(null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } def "Create file min"() { @@ -1118,9 +1117,9 @@ class DirectoryAPITest extends APISpec { client.getPropertiesWithResponse(null, null, null) then: - def e = thrown(BlobStorageException) + def e = thrown(DataLakeStorageException) e.getResponse().getStatusCode() == 404 - e.getErrorCode() == BlobErrorCode.BLOB_NOT_FOUND + e.getErrorCode() == BlobErrorCode.BLOB_NOT_FOUND.toString() // e.getServiceMessage().contains("The specified blob does not exist.") } @@ -1352,9 +1351,9 @@ class DirectoryAPITest extends APISpec { client.getPropertiesWithResponse(null, null, null) then: - def e = thrown(BlobStorageException) + def e = thrown(DataLakeStorageException) e.getResponse().getStatusCode() == 404 - e.getErrorCode() == BlobErrorCode.BLOB_NOT_FOUND + e.getErrorCode() == BlobErrorCode.BLOB_NOT_FOUND.toString() // e.getServiceMessage().contains("The specified blob does not exist.") } 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 6e818e9aa3bb..5f6934b40f47 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 @@ -5,9 +5,7 @@ import com.azure.core.util.Context import com.azure.identity.DefaultAzureCredentialBuilder import com.azure.storage.blob.BlobUrlParts import com.azure.storage.blob.models.BlobErrorCode -import com.azure.storage.blob.models.BlobStorageException -import com.azure.storage.file.datalake.implementation.models.StorageErrorException import com.azure.storage.file.datalake.models.* import spock.lang.Unroll @@ -192,9 +190,9 @@ class FileAPITest extends APISpec { fc.getPropertiesWithResponse(null, null, null) then: - def e = thrown(BlobStorageException) + def e = thrown(DataLakeStorageException) e.getResponse().getStatusCode() == 404 - e.getErrorCode() == BlobErrorCode.BLOB_NOT_FOUND + e.getErrorCode() == BlobErrorCode.BLOB_NOT_FOUND.toString() // e.getServiceMessage().contains("The specified blob does not exist.") } @@ -562,7 +560,7 @@ class FileAPITest extends APISpec { fc.getPropertiesWithResponse(drc, null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -581,7 +579,7 @@ class FileAPITest extends APISpec { fc.getProperties() then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } def "Set HTTP headers null"() { @@ -677,7 +675,7 @@ class FileAPITest extends APISpec { fc.setHttpHeadersWithResponse(null, drc, null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -696,7 +694,7 @@ class FileAPITest extends APISpec { fc.setHttpHeaders(null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } def "Set metadata min"() { @@ -774,7 +772,7 @@ class FileAPITest extends APISpec { fc.setMetadataWithResponse(null, drc, null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -793,7 +791,7 @@ class FileAPITest extends APISpec { fc.setMetadata(null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } def "Read all null"() { @@ -844,7 +842,7 @@ class FileAPITest extends APISpec { def result = outStream.toByteArray() then: - notThrown(BlobStorageException) + notThrown(DataLakeStorageException) result.length == 0 } @@ -962,7 +960,7 @@ class FileAPITest extends APISpec { fc.readWithResponse(new ByteArrayOutputStream(), null, null, drc, false, null, null).getStatusCode() then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch | leaseID @@ -1016,7 +1014,7 @@ class FileAPITest extends APISpec { fc.getProperties() then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } def "Rename error"() { diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileSystemAPITest.groovy b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileSystemAPITest.groovy index 93ea005141b8..b49410e1f345 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileSystemAPITest.groovy +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileSystemAPITest.groovy @@ -4,17 +4,13 @@ import com.azure.core.util.Context import com.azure.identity.DefaultAzureCredentialBuilder import com.azure.storage.blob.BlobUrlParts import com.azure.storage.blob.models.BlobErrorCode -import com.azure.storage.blob.models.BlobStorageException import com.azure.storage.common.Utility -import com.azure.storage.file.datalake.implementation.models.StorageErrorException import com.azure.storage.file.datalake.models.* import spock.lang.Unroll import java.time.OffsetDateTime import java.time.ZoneId import java.time.temporal.ChronoUnit -import java.time.temporal.Temporal -import java.time.temporal.TemporalUnit class FileSystemAPITest extends APISpec { @@ -91,9 +87,9 @@ class FileSystemAPITest extends APISpec { fsc.create() then: - def e = thrown(BlobStorageException) + def e = thrown(DataLakeStorageException) e.getResponse().getStatusCode() == 409 - e.getErrorCode() == BlobErrorCode.CONTAINER_ALREADY_EXISTS + e.getErrorCode() == BlobErrorCode.CONTAINER_ALREADY_EXISTS.toString() e.getServiceMessage().contains("The specified container already exists.") } @@ -130,7 +126,7 @@ class FileSystemAPITest extends APISpec { fsc.getPropertiesWithResponse("garbage", null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } def "Get properties error"() { @@ -141,7 +137,7 @@ class FileSystemAPITest extends APISpec { fsc.getProperties() then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } def "Set metadata"() { @@ -222,7 +218,7 @@ class FileSystemAPITest extends APISpec { fsc.setMetadataWithResponse(null, drc, null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: modified | leaseID @@ -259,7 +255,7 @@ class FileSystemAPITest extends APISpec { fsc.setMetadata(null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } def "Delete"() { @@ -281,9 +277,9 @@ class FileSystemAPITest extends APISpec { fsc.getProperties() then: - def e = thrown(BlobStorageException) + def e = thrown(DataLakeStorageException) e.getResponse().getStatusCode() == 404 - e.getErrorCode() == BlobErrorCode.CONTAINER_NOT_FOUND + e.getErrorCode() == BlobErrorCode.CONTAINER_NOT_FOUND.toString() e.getServiceMessage().contains("The specified container does not exist.") } @@ -319,7 +315,7 @@ class FileSystemAPITest extends APISpec { fsc.deleteWithResponse(drc, null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: modified | unmodified | leaseID @@ -355,7 +351,7 @@ class FileSystemAPITest extends APISpec { fsc.delete() then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } def "Create file min"() { @@ -518,9 +514,9 @@ class FileSystemAPITest extends APISpec { client.getPropertiesWithResponse(null, null, null) then: - def e = thrown(BlobStorageException) + def e = thrown(DataLakeStorageException) e.getResponse().getStatusCode() == 404 - e.getErrorCode() == BlobErrorCode.BLOB_NOT_FOUND + e.getErrorCode() == BlobErrorCode.BLOB_NOT_FOUND.toString() // e.getServiceMessage().contains("The specified blob does not exist.") } @@ -752,9 +748,9 @@ class FileSystemAPITest extends APISpec { client.getPropertiesWithResponse(null, null, null) then: - def e = thrown(BlobStorageException) + def e = thrown(DataLakeStorageException) e.getResponse().getStatusCode() == 404 - e.getErrorCode() == BlobErrorCode.BLOB_NOT_FOUND + e.getErrorCode() == BlobErrorCode.BLOB_NOT_FOUND.toString() // e.getServiceMessage().contains("The specified blob does not exist.") } @@ -1048,7 +1044,7 @@ class FileSystemAPITest extends APISpec { fsc.setAccessPolicyWithResponse(null, null, cac, null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: modified | unmodified | leaseID @@ -1082,7 +1078,7 @@ class FileSystemAPITest extends APISpec { fsc.setAccessPolicy(null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } def "Get access policy"() { @@ -1119,7 +1115,7 @@ class FileSystemAPITest extends APISpec { fsc.getAccessPolicyWithResponse(garbageLeaseID, null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } def "Get access policy error"() { @@ -1130,7 +1126,7 @@ class FileSystemAPITest extends APISpec { fsc.getAccessPolicy() then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } def "Builder bearer token validation"() { diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/SASTest.groovy b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/SASTest.groovy index 5b8cc6462e32..6e16cd439b61 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/SASTest.groovy +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/SASTest.groovy @@ -4,11 +4,8 @@ package com.azure.storage.file.datalake import com.azure.storage.blob.implementation.util.BlobSasImplUtil -import com.azure.storage.blob.models.BlobStorageException import com.azure.storage.common.implementation.Constants -import com.azure.storage.common.implementation.StorageImplUtils import com.azure.storage.common.sas.* -import com.azure.storage.file.datalake.implementation.models.StorageErrorException import com.azure.storage.file.datalake.models.DataLakeAccessPolicy import com.azure.storage.file.datalake.models.DataLakeSignedIdentifier import com.azure.storage.file.datalake.models.DataLakeStorageException @@ -123,7 +120,7 @@ class SASTest extends APISpec { then: os.toString() == new String(defaultData.array()) validateSasProperties(properties) - notThrown(BlobStorageException) + notThrown(DataLakeStorageException) } def "serviceSASSignatureValues network test file system"() { @@ -164,7 +161,7 @@ class SASTest extends APISpec { client2.listPaths().iterator().hasNext() then: - notThrown(BlobStorageException) + notThrown(DataLakeStorageException) } def "serviceSASSignatureValues network test file user delegation"() { @@ -190,7 +187,7 @@ class SASTest extends APISpec { then: os.toString() == new String(defaultData.array()) validateSasProperties(properties) - notThrown(BlobStorageException) + notThrown(DataLakeStorageException) } def "serviceSASSignatureValues network test file system user delegation"() { @@ -221,7 +218,7 @@ class SASTest extends APISpec { client.listPaths().iterator().hasNext() then: - notThrown(BlobStorageException) + notThrown(DataLakeStorageException) } def "accountSAS network test file read"() { @@ -299,7 +296,7 @@ class SASTest extends APISpec { sc.createFileSystem(generateFileSystemName()) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } def "accountSAS network create file system succeeds"() { @@ -322,7 +319,7 @@ class SASTest extends APISpec { sc.createFileSystem(generateFileSystemName()) then: - notThrown(BlobStorageException) + notThrown(DataLakeStorageException) } def "accountSAS network account sas token on endpoint"() { diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/ServiceAPITest.groovy b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/ServiceAPITest.groovy index 93669173678c..e7517df163cf 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/ServiceAPITest.groovy +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/ServiceAPITest.groovy @@ -3,10 +3,12 @@ package com.azure.storage.file.datalake +import com.azure.core.http.rest.PagedIterable import com.azure.core.http.rest.Response import com.azure.identity.DefaultAzureCredentialBuilder import com.azure.storage.blob.BlobUrlParts import com.azure.storage.blob.models.BlobStorageException +import com.azure.storage.file.datalake.models.DataLakeStorageException import com.azure.storage.file.datalake.models.FileSystemItem import com.azure.storage.file.datalake.models.FileSystemListDetails import com.azure.storage.file.datalake.models.ListFileSystemsOptions @@ -41,7 +43,7 @@ class ServiceAPITest extends APISpec { primaryDataLakeServiceClient.listFileSystems().iterator().hasNext() then: - notThrown(BlobStorageException) + notThrown(DataLakeStorageException) } def "List file systems marker"() { diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/specialized/LeaseAPITest.groovy b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/specialized/LeaseAPITest.groovy index e8b541334b09..c8047bcfebce 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/specialized/LeaseAPITest.groovy +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/specialized/LeaseAPITest.groovy @@ -4,9 +4,9 @@ package com.azure.storage.file.datalake.specialized import com.azure.core.http.RequestConditions -import com.azure.storage.blob.models.BlobStorageException import com.azure.storage.file.datalake.APISpec import com.azure.storage.file.datalake.DataLakeFileClient +import com.azure.storage.file.datalake.models.DataLakeStorageException import com.azure.storage.file.datalake.models.LeaseDurationType import com.azure.storage.file.datalake.models.LeaseStateType import spock.lang.Unroll @@ -63,7 +63,7 @@ class LeaseAPITest extends APISpec { leaseClient.acquireLease(duration) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: duration | _ @@ -112,7 +112,7 @@ class LeaseAPITest extends APISpec { createLeaseClient(fc).acquireLeaseWithResponse(-1, mac, null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch @@ -130,7 +130,7 @@ class LeaseAPITest extends APISpec { createLeaseClient(fc).acquireLease(20) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } def "Renew file lease"() { @@ -201,7 +201,7 @@ class LeaseAPITest extends APISpec { createLeaseClient(fc, leaseID).renewLeaseWithResponse(mac, null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch @@ -219,7 +219,7 @@ class LeaseAPITest extends APISpec { createLeaseClient(fc, "id").renewLease() then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } def "Release file lease"() { @@ -282,7 +282,7 @@ class LeaseAPITest extends APISpec { createLeaseClient(fc, leaseID).releaseLeaseWithResponse(mac, null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch @@ -300,7 +300,7 @@ class LeaseAPITest extends APISpec { createLeaseClient(fc, "id").releaseLease() then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } @Unroll @@ -375,7 +375,7 @@ class LeaseAPITest extends APISpec { createLeaseClient(fc).breakLeaseWithResponse(null, mac, null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch @@ -393,7 +393,7 @@ class LeaseAPITest extends APISpec { createLeaseClient(fc).breakLease() then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } def "Change file lease"() { @@ -458,7 +458,7 @@ class LeaseAPITest extends APISpec { createLeaseClient(fc, leaseID).changeLeaseWithResponse(getRandomUUID(), mac, null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: modified | unmodified | match | noneMatch @@ -476,7 +476,7 @@ class LeaseAPITest extends APISpec { createLeaseClient(fc, "id").changeLease("id") then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } @@ -515,7 +515,7 @@ class LeaseAPITest extends APISpec { leaseClient.acquireLease(duration) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: duration | _ @@ -554,7 +554,7 @@ class LeaseAPITest extends APISpec { createLeaseClient(fsc).acquireLeaseWithResponse(-1, mac, null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: modified | unmodified @@ -570,7 +570,7 @@ class LeaseAPITest extends APISpec { createLeaseClient(fsc).acquireLease(50) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } def "Renew file system lease"() { @@ -620,7 +620,7 @@ class LeaseAPITest extends APISpec { createLeaseClient(fsc, leaseID).renewLeaseWithResponse(mac, null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: modified | unmodified @@ -637,7 +637,7 @@ class LeaseAPITest extends APISpec { createLeaseClient(fsc, APISpec.receivedEtag).renewLeaseWithResponse(mac, null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: match | noneMatch @@ -653,7 +653,7 @@ class LeaseAPITest extends APISpec { createLeaseClient(fsc, "id").renewLease() then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } def "Release file system lease"() { @@ -701,7 +701,7 @@ class LeaseAPITest extends APISpec { createLeaseClient(fsc, leaseID).releaseLeaseWithResponse(mac, null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: modified | unmodified @@ -718,7 +718,7 @@ class LeaseAPITest extends APISpec { createLeaseClient(fsc, APISpec.receivedLeaseID).releaseLeaseWithResponse(mac, null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: match | noneMatch @@ -734,7 +734,7 @@ class LeaseAPITest extends APISpec { createLeaseClient(fsc, "id").releaseLease() then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } @Unroll @@ -797,7 +797,7 @@ class LeaseAPITest extends APISpec { createLeaseClient(fsc).breakLeaseWithResponse(null, mac, null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: modified | unmodified @@ -814,7 +814,7 @@ class LeaseAPITest extends APISpec { createLeaseClient(fsc).breakLeaseWithResponse(null, mac, null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: match | noneMatch @@ -830,7 +830,7 @@ class LeaseAPITest extends APISpec { createLeaseClient(fsc).breakLease() then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } def "Change file system lease"() { @@ -879,7 +879,7 @@ class LeaseAPITest extends APISpec { createLeaseClient(fsc, leaseID).changeLeaseWithResponse(getRandomUUID(), mac, null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: modified | unmodified @@ -896,7 +896,7 @@ class LeaseAPITest extends APISpec { createLeaseClient(fsc, APISpec.receivedLeaseID).changeLeaseWithResponse(APISpec.garbageLeaseID, mac, null, null) then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) where: match | noneMatch @@ -912,6 +912,6 @@ class LeaseAPITest extends APISpec { createLeaseClient(fsc, "id").changeLease("id") then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } } diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/specialized/LeaseAsyncErrorMappingTest.groovy b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/specialized/LeaseAsyncErrorMappingTest.groovy new file mode 100644 index 000000000000..5e175fdf22b0 --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/specialized/LeaseAsyncErrorMappingTest.groovy @@ -0,0 +1,69 @@ +package com.azure.storage.file.datalake.specialized + +import com.azure.storage.file.datalake.APISpec +import com.azure.storage.file.datalake.DataLakeFileAsyncClient +import com.azure.storage.file.datalake.models.DataLakeStorageException +import reactor.test.StepVerifier + +class LeaseAsyncErrorMappingTest extends APISpec { + private DataLakeFileAsyncClient createPathAsyncClient() { + def fac = getServiceAsyncClient(primaryCredential) + .createFileSystem(generateFileSystemName()).block() + .getFileAsyncClient(generatePathName()) + return fac + } + + DataLakeFileAsyncClient fac + DataLakeLeaseAsyncClient leaseAsyncClient + + def setup() { + fac = createPathAsyncClient() + leaseAsyncClient = createLeaseAsyncClient(fac) + } + + def "Acquire Lease"() { + when: + def acquireLeaseVerifier = StepVerifier.create(leaseAsyncClient.acquireLeaseWithResponse(-10, null)) + then: + acquireLeaseVerifier.verifyErrorSatisfies { + assert it instanceof DataLakeStorageException + } + } + + def "Renew Lease"() { + when: + def renewLeaseVerifier = StepVerifier.create(leaseAsyncClient.renewLeaseWithResponse(null)) + then: + renewLeaseVerifier.verifyErrorSatisfies { + assert it instanceof DataLakeStorageException + } + } + + def "Release Lease"() { + when: + def releaseLeaseVerifier = StepVerifier.create(leaseAsyncClient.releaseLeaseWithResponse(null)) + then: + releaseLeaseVerifier.verifyErrorSatisfies { + assert it instanceof DataLakeStorageException + } + } + + def "Change Lease"() { + when: + def changeLeaseVerifier = StepVerifier.create(leaseAsyncClient.changeLeaseWithResponse(null, null)) + then: + changeLeaseVerifier.verifyErrorSatisfies { + assert it instanceof DataLakeStorageException + } + } + + def "Break Lease"() { + when: + def breakLeaseVerifier = StepVerifier.create(leaseAsyncClient.breakLeaseWithResponse(null, null)) + then: + breakLeaseVerifier.verifyErrorSatisfies { + assert it instanceof DataLakeStorageException + } + } + +} diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestcreatefilesystem.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestcreatefilesystem.json new file mode 100644 index 000000000000..ed13ddb7232a --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestcreatefilesystem.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfscreatefilesystem0635390a8a5342aef74156bc?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" : "3f79ceff-5f1c-4693-90b1-6e63593657c3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DBFAD8520AF", + "Last-Modified" : "Tue, 10 Dec 2019 22:24:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e272146e-401e-0017-60a8-af8e19000000", + "Date" : "Tue, 10 Dec 2019 22:24:09 GMT", + "x-ms-client-request-id" : "3f79ceff-5f1c-4693-90b1-6e63593657c3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfscreatefilesystem1528863dc510b2b6e443dd94?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" : "13dc8504-da5c-46e5-96dd-8112f9df45dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DBFADA72DC1", + "Last-Modified" : "Tue, 10 Dec 2019 22:24:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27214e3-401e-0017-47a8-af8e19000000", + "Date" : "Tue, 10 Dec 2019 22:24:09 GMT", + "x-ms-client-request-id" : "13dc8504-da5c-46e5-96dd-8112f9df45dc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfscreatefilesystem1528863dc510b2b6e443dd94?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" : "a9e6b42c-56f9-44e3-a2f1-7891a6716651" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerAlreadyExists", + "retry-after" : "0", + "Content-Length" : "230", + "StatusCode" : "409", + "x-ms-request-id" : "e272150e-401e-0017-70a8-af8e19000000", + "Body" : "ContainerAlreadyExistsThe specified container already exists.\nRequestId:e272150e-401e-0017-70a8-af8e19000000\nTime:2019-12-10T22:24:10.2805321Z", + "Date" : "Tue, 10 Dec 2019 22:24:09 GMT", + "x-ms-client-request-id" : "a9e6b42c-56f9-44e3-a2f1-7891a6716651", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://gaprahns.blob.core.windows.net?prefix=jtfscreatefilesystem&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" : "582cb319-cddf-4e7b-a860-f21c84016621" + }, + "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" : "e2721553-401e-0017-2ea8-af8e19000000", + "Body" : "jtfscreatefilesystemjtfscreatefilesystem0635390a8a5342aef74156bcTue, 10 Dec 2019 22:24:09 GMT\"0x8D77DBFAD8520AF\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfscreatefilesystem1528863dc510b2b6e443dd94Tue, 10 Dec 2019 22:24:10 GMT\"0x8D77DBFADA72DC1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Tue, 10 Dec 2019 22:24:09 GMT", + "x-ms-client-request-id" : "582cb319-cddf-4e7b-a860-f21c84016621", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfscreatefilesystem0635390a8a5342aef74156bc?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" : "9dd1da16-f820-47f2-82d2-a4ef28d286ec" + }, + "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" : "e272156d-401e-0017-44a8-af8e19000000", + "Date" : "Tue, 10 Dec 2019 22:24:09 GMT", + "x-ms-client-request-id" : "9dd1da16-f820-47f2-82d2-a4ef28d286ec" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfscreatefilesystem1528863dc510b2b6e443dd94?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" : "99e94f47-76f1-4888-b77d-aa138bc72721" + }, + "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" : "e2721582-401e-0017-51a8-af8e19000000", + "Date" : "Tue, 10 Dec 2019 22:24:09 GMT", + "x-ms-client-request-id" : "99e94f47-76f1-4888-b77d-aa138bc72721" + }, + "Exception" : null + } ], + "variables" : [ "jtfscreatefilesystem0635390a8a5342aef74156bc", "jtfscreatefilesystem1528863dc510b2b6e443dd94" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestdeletefilesystem.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestdeletefilesystem.json new file mode 100644 index 000000000000..1f376cd36871 --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestdeletefilesystem.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsdeletefilesystem089903ad3bb74a625f42888f?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" : "917d36e4-2d77-4161-99ac-2a5a5d1bd702" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DBFB192FF68", + "Last-Modified" : "Tue, 10 Dec 2019 22:24:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e2721c8b-401e-0017-10a8-af8e19000000", + "Date" : "Tue, 10 Dec 2019 22:24:15 GMT", + "x-ms-client-request-id" : "917d36e4-2d77-4161-99ac-2a5a5d1bd702" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsdeletefilesystem1115884f26f935c42f4695a6?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" : "4cc1360d-e292-4aab-8fdb-e0458b4ebd5e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DBFB1AE2D69", + "Last-Modified" : "Tue, 10 Dec 2019 22:24:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e2721caa-401e-0017-27a8-af8e19000000", + "Date" : "Tue, 10 Dec 2019 22:24:16 GMT", + "x-ms-client-request-id" : "4cc1360d-e292-4aab-8fdb-e0458b4ebd5e" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsdeletefilesystem200449a51e251c74774b74a9?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" : "08770211-159e-4160-8249-93dbc07c90b1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "e2721cc8-401e-0017-42a8-af8e19000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:e2721cc8-401e-0017-42a8-af8e19000000\nTime:2019-12-10T22:24:17.0422889Z", + "Date" : "Tue, 10 Dec 2019 22:24:16 GMT", + "x-ms-client-request-id" : "08770211-159e-4160-8249-93dbc07c90b1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://gaprahns.blob.core.windows.net?prefix=jtfsdeletefilesystem&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" : "20f70a83-1c7f-406e-97eb-2d7699b1805d" + }, + "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" : "e2721cff-401e-0017-6fa8-af8e19000000", + "Body" : "jtfsdeletefilesystemjtfsdeletefilesystem089903ad3bb74a625f42888fTue, 10 Dec 2019 22:24:16 GMT\"0x8D77DBFB192FF68\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfsdeletefilesystem1115884f26f935c42f4695a6Tue, 10 Dec 2019 22:24:16 GMT\"0x8D77DBFB1AE2D69\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Tue, 10 Dec 2019 22:24:16 GMT", + "x-ms-client-request-id" : "20f70a83-1c7f-406e-97eb-2d7699b1805d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsdeletefilesystem089903ad3bb74a625f42888f?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" : "95905277-f429-46b6-875c-50e957c20110" + }, + "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" : "e2721d1f-401e-0017-0da8-af8e19000000", + "Date" : "Tue, 10 Dec 2019 22:24:16 GMT", + "x-ms-client-request-id" : "95905277-f429-46b6-875c-50e957c20110" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsdeletefilesystem1115884f26f935c42f4695a6?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" : "3b3625c5-6a7b-40b3-9aa8-3480be6a7c5e" + }, + "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" : "e2721d37-401e-0017-24a8-af8e19000000", + "Date" : "Tue, 10 Dec 2019 22:24:16 GMT", + "x-ms-client-request-id" : "3b3625c5-6a7b-40b3-9aa8-3480be6a7c5e" + }, + "Exception" : null + } ], + "variables" : [ "jtfsdeletefilesystem089903ad3bb74a625f42888f", "jtfsdeletefilesystem1115884f26f935c42f4695a6", "jtfsdeletefilesystem200449a51e251c74774b74a9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestgetdirectoryproperties.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestgetdirectoryproperties.json new file mode 100644 index 000000000000..502c77e0e675 --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestgetdirectoryproperties.json @@ -0,0 +1,124 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsgetdirectoryproperties06845176794473d425454?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" : "06a0237d-ea41-45a8-8610-5caf8de044ef" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DBED49D5DBD", + "Last-Modified" : "Tue, 10 Dec 2019 22:18:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "4944ea40-601e-0066-02a7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:18:05 GMT", + "x-ms-client-request-id" : "06a0237d-ea41-45a8-8610-5caf8de044ef" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsgetdirectoryproperties144653881d96dc286d4f2?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" : "02877df7-0357-499a-9a0b-8a79646d341c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DBED4BC0EDA", + "Last-Modified" : "Tue, 10 Dec 2019 22:18:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "4944ea92-601e-0066-4ba7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:18:05 GMT", + "x-ms-client-request-id" : "02877df7-0357-499a-9a0b-8a79646d341c" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsgetdirectoryproperties144653881d96dc286d4f2/javapathgetdirectoryproperties26658026708c906a5e4", + "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" : "d84eb136-6c36-4fcd-9a5a-23af693b7517" + }, + "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" : "4944eaad-601e-0066-62a7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:18:05 GMT", + "x-ms-client-request-id" : "d84eb136-6c36-4fcd-9a5a-23af693b7517" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://gaprahns.blob.core.windows.net?prefix=jtfsgetdirectoryproperties&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" : "db348f42-846d-4447-896b-ee33de28061e" + }, + "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" : "4944eac5-601e-0066-77a7-affc20000000", + "Body" : "jtfsgetdirectorypropertiesjtfsgetdirectoryproperties06845176794473d425454Tue, 10 Dec 2019 22:18:06 GMT\"0x8D77DBED49D5DBD\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfsgetdirectoryproperties144653881d96dc286d4f2Tue, 10 Dec 2019 22:18:06 GMT\"0x8D77DBED4BC0EDA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Tue, 10 Dec 2019 22:18:05 GMT", + "x-ms-client-request-id" : "db348f42-846d-4447-896b-ee33de28061e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsgetdirectoryproperties06845176794473d425454?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" : "f5f839a2-39c2-40e1-97af-449f66d1167f" + }, + "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" : "4944eafc-601e-0066-2aa7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:18:05 GMT", + "x-ms-client-request-id" : "f5f839a2-39c2-40e1-97af-449f66d1167f" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsgetdirectoryproperties144653881d96dc286d4f2?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" : "f96a0289-3edd-4746-8153-c099b15ceba5" + }, + "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" : "4944eb18-601e-0066-44a7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:18:05 GMT", + "x-ms-client-request-id" : "f96a0289-3edd-4746-8153-c099b15ceba5" + }, + "Exception" : null + } ], + "variables" : [ "jtfsgetdirectoryproperties06845176794473d425454", "jtfsgetdirectoryproperties144653881d96dc286d4f2", "javapathgetdirectoryproperties26658026708c906a5e4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestgetfileproperties.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestgetfileproperties.json new file mode 100644 index 000000000000..a9bd2f407260 --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestgetfileproperties.json @@ -0,0 +1,124 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsgetfileproperties088557cfcb6e3a0ab0419f89?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" : "02430b9e-da9e-4a5f-85f1-f9ed3e9d9f1b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DBE369952D5", + "Last-Modified" : "Tue, 10 Dec 2019 22:13:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "49436330-601e-0066-0aa7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:13:40 GMT", + "x-ms-client-request-id" : "02430b9e-da9e-4a5f-85f1-f9ed3e9d9f1b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsgetfileproperties1801762c4a213107bb491e9e?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" : "15531968-9265-4d5b-9407-0129f1d4599e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DBE36BD34F3", + "Last-Modified" : "Tue, 10 Dec 2019 22:13:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "494363a0-601e-0066-6ca7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:13:40 GMT", + "x-ms-client-request-id" : "15531968-9265-4d5b-9407-0129f1d4599e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsgetfileproperties1801762c4a213107bb491e9e/javapathgetfileproperties20191102217d1c14d24da6", + "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" : "58086d44-2647-4038-ac9c-22a7e2dc6c6e" + }, + "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" : "494363d2-601e-0066-1aa7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:13:41 GMT", + "x-ms-client-request-id" : "58086d44-2647-4038-ac9c-22a7e2dc6c6e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://gaprahns.blob.core.windows.net?prefix=jtfsgetfileproperties&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" : "bffb64e8-117e-4b77-9aa7-4f40207f7935" + }, + "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" : "494363fc-601e-0066-40a7-affc20000000", + "Body" : "jtfsgetfilepropertiesjtfsgetfileproperties088557cfcb6e3a0ab0419f89Tue, 10 Dec 2019 22:13:40 GMT\"0x8D77DBE369952D5\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfsgetfileproperties1801762c4a213107bb491e9eTue, 10 Dec 2019 22:13:41 GMT\"0x8D77DBE36BD34F3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Tue, 10 Dec 2019 22:13:41 GMT", + "x-ms-client-request-id" : "bffb64e8-117e-4b77-9aa7-4f40207f7935", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsgetfileproperties088557cfcb6e3a0ab0419f89?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" : "c01b3330-e2f8-4ec9-8fce-eb8b755e3d17" + }, + "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" : "49436418-601e-0066-5ba7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:13:41 GMT", + "x-ms-client-request-id" : "c01b3330-e2f8-4ec9-8fce-eb8b755e3d17" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsgetfileproperties1801762c4a213107bb491e9e?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" : "bd4d47e4-2ac0-4036-82fb-15c995eb73ff" + }, + "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" : "4943642d-601e-0066-6ea7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:13:41 GMT", + "x-ms-client-request-id" : "bd4d47e4-2ac0-4036-82fb-15c995eb73ff" + }, + "Exception" : null + } ], + "variables" : [ "jtfsgetfileproperties088557cfcb6e3a0ab0419f89", "jtfsgetfileproperties1801762c4a213107bb491e9e", "javapathgetfileproperties20191102217d1c14d24da6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestgetfilesystemproperties.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestgetfilesystemproperties.json new file mode 100644 index 000000000000..fe4794b4403a --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestgetfilesystemproperties.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsgetfilesystemproperties0229480b0e7279993b41a?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" : "7ec55c5b-211d-4b62-86e0-b23000ea22f6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DBF4DAA16F1", + "Last-Modified" : "Tue, 10 Dec 2019 22:21:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e2715409-401e-0017-75a8-af8e19000000", + "Date" : "Tue, 10 Dec 2019 22:21:28 GMT", + "x-ms-client-request-id" : "7ec55c5b-211d-4b62-86e0-b23000ea22f6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsgetfilesystemproperties1348314f03ffb6ee9e4ea?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" : "c02c44d9-59f7-45aa-9b09-537f8c7acd11" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DBF4DC67DAA", + "Last-Modified" : "Tue, 10 Dec 2019 22:21:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e271542b-401e-0017-10a8-af8e19000000", + "Date" : "Tue, 10 Dec 2019 22:21:28 GMT", + "x-ms-client-request-id" : "c02c44d9-59f7-45aa-9b09-537f8c7acd11" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsgetfilesystemproperties2322352e33f504b172413?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" : "7af7c737-668c-49ed-83c1-37e280824ddb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "e2715451-401e-0017-30a8-af8e19000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:e2715451-401e-0017-30a8-af8e19000000\nTime:2019-12-10T22:21:29.4845085Z", + "Date" : "Tue, 10 Dec 2019 22:21:28 GMT", + "x-ms-client-request-id" : "7af7c737-668c-49ed-83c1-37e280824ddb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://gaprahns.blob.core.windows.net?prefix=jtfsgetfilesystemproperties&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" : "99bba2cb-4e43-4cb7-ae32-1e3d58c0a9ee" + }, + "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" : "e2715466-401e-0017-42a8-af8e19000000", + "Body" : "jtfsgetfilesystempropertiesjtfsgetfilesystemproperties0229480b0e7279993b41aTue, 10 Dec 2019 22:21:29 GMT\"0x8D77DBF4DAA16F1\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfsgetfilesystemproperties1348314f03ffb6ee9e4eaTue, 10 Dec 2019 22:21:29 GMT\"0x8D77DBF4DC67DAA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Tue, 10 Dec 2019 22:21:29 GMT", + "x-ms-client-request-id" : "99bba2cb-4e43-4cb7-ae32-1e3d58c0a9ee", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsgetfilesystemproperties0229480b0e7279993b41a?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" : "adc053f0-004b-4bd7-a8cf-24cf103d6ff2" + }, + "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" : "e2715476-401e-0017-52a8-af8e19000000", + "Date" : "Tue, 10 Dec 2019 22:21:29 GMT", + "x-ms-client-request-id" : "adc053f0-004b-4bd7-a8cf-24cf103d6ff2" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsgetfilesystemproperties1348314f03ffb6ee9e4ea?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" : "4529fc12-73c2-498f-b862-fcb351d819e5" + }, + "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" : "e2715486-401e-0017-62a8-af8e19000000", + "Date" : "Tue, 10 Dec 2019 22:21:29 GMT", + "x-ms-client-request-id" : "4529fc12-73c2-498f-b862-fcb351d819e5" + }, + "Exception" : null + } ], + "variables" : [ "jtfsgetfilesystemproperties0229480b0e7279993b41a", "jtfsgetfilesystemproperties1348314f03ffb6ee9e4ea", "jtfsgetfilesystemproperties2322352e33f504b172413" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestreadfile.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestreadfile.json new file mode 100644 index 000000000000..6a74ba17893c --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestreadfile.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsreadfile0asyncerrormappingtestreadfiled335395118d5a7?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" : "75823295-27a8-4a2b-9ebf-1f47d1bbd5dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DBDC9ABB7A9", + "Last-Modified" : "Tue, 10 Dec 2019 22:10:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e7f4ddb5-701e-00be-44a6-af5bf1000000", + "Date" : "Tue, 10 Dec 2019 22:10:37 GMT", + "x-ms-client-request-id" : "75823295-27a8-4a2b-9ebf-1f47d1bbd5dc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsreadfile1asyncerrormappingtestreadfiled3305911f7876a?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" : "7473fe05-38ff-4384-a488-65ea04e4dc38" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DBDC9C44D2C", + "Last-Modified" : "Tue, 10 Dec 2019 22:10:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e7f4de23-701e-00be-1ba6-af5bf1000000", + "Date" : "Tue, 10 Dec 2019 22:10:37 GMT", + "x-ms-client-request-id" : "7473fe05-38ff-4384-a488-65ea04e4dc38" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsreadfile1asyncerrormappingtestreadfiled3305911f7876a/javapathreadfile2asyncerrormappingtestreadfiled333422099f3", + "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" : "ed269b00-5792-4435-8af2-13d16c8f73b3" + }, + "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", + "Content-Length" : "215", + "StatusCode" : "404", + "x-ms-request-id" : "e7f4de60-701e-00be-51a6-af5bf1000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:e7f4de60-701e-00be-51a6-af5bf1000000\nTime:2019-12-10T22:10:38.4721499Z", + "Date" : "Tue, 10 Dec 2019 22:10:37 GMT", + "x-ms-client-request-id" : "ed269b00-5792-4435-8af2-13d16c8f73b3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://gaprahns.blob.core.windows.net?prefix=jtfsreadfile&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" : "d9db5008-559b-4965-95ee-6ac129434dd3" + }, + "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" : "e7f4deba-701e-00be-20a6-af5bf1000000", + "Body" : "jtfsreadfilejtfsreadfile0asyncerrormappingtestreadfiled335395118d5a7Tue, 10 Dec 2019 22:10:38 GMT\"0x8D77DBDC9ABB7A9\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfsreadfile1asyncerrormappingtestreadfiled3305911f7876aTue, 10 Dec 2019 22:10:38 GMT\"0x8D77DBDC9C44D2C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Tue, 10 Dec 2019 22:10:37 GMT", + "x-ms-client-request-id" : "d9db5008-559b-4965-95ee-6ac129434dd3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsreadfile0asyncerrormappingtestreadfiled335395118d5a7?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" : "93469513-5bcd-4f41-b08d-b6c8c6cb6609" + }, + "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" : "e7f4dee7-701e-00be-49a6-af5bf1000000", + "Date" : "Tue, 10 Dec 2019 22:10:37 GMT", + "x-ms-client-request-id" : "93469513-5bcd-4f41-b08d-b6c8c6cb6609" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsreadfile1asyncerrormappingtestreadfiled3305911f7876a?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" : "097c07df-27f3-45a6-a1c6-cc2138ecf670" + }, + "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" : "e7f4defb-701e-00be-5aa6-af5bf1000000", + "Date" : "Tue, 10 Dec 2019 22:10:38 GMT", + "x-ms-client-request-id" : "097c07df-27f3-45a6-a1c6-cc2138ecf670" + }, + "Exception" : null + } ], + "variables" : [ "jtfsreadfile0asyncerrormappingtestreadfiled335395118d5a7", "jtfsreadfile1asyncerrormappingtestreadfiled3305911f7876a", "javapathreadfile2asyncerrormappingtestreadfiled333422099f3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestsetdirectoryhttpproperties.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestsetdirectoryhttpproperties.json new file mode 100644 index 000000000000..e1dbfc68307d --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestsetdirectoryhttpproperties.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfssetdirectoryhttpproperties0354466ccdff8fbaeb4?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" : "8f87744b-fd8d-4b81-872e-828c0049aadc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DBEDAD0F162", + "Last-Modified" : "Tue, 10 Dec 2019 22:18:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "4944f8b3-601e-0066-11a7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:18:15 GMT", + "x-ms-client-request-id" : "8f87744b-fd8d-4b81-872e-828c0049aadc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfssetdirectoryhttpproperties13299405c36839bf494?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" : "77d3ddf1-fa7a-4f24-96c6-95ee3c3840c4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DBEDAE9FC29", + "Last-Modified" : "Tue, 10 Dec 2019 22:18:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "4944f8df-601e-0066-35a7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:18:15 GMT", + "x-ms-client-request-id" : "77d3ddf1-fa7a-4f24-96c6-95ee3c3840c4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfssetdirectoryhttpproperties13299405c36839bf494/javapathsetdirectoryhttpproperties27207705ad77b2c2c?comp=properties", + "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" : "a6a9b0a0-7ee2-41cd-acc2-f277273da618" + }, + "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", + "Content-Length" : "215", + "StatusCode" : "404", + "x-ms-request-id" : "4944f8fc-601e-0066-4ca7-affc20000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:4944f8fc-601e-0066-4ca7-affc20000000\nTime:2019-12-10T22:18:16.7551219Z", + "Date" : "Tue, 10 Dec 2019 22:18:15 GMT", + "x-ms-client-request-id" : "a6a9b0a0-7ee2-41cd-acc2-f277273da618", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://gaprahns.blob.core.windows.net?prefix=jtfssetdirectoryhttpproperties&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" : "c941c933-4169-4130-86ec-997cdcd97453" + }, + "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" : "4944f91e-601e-0066-68a7-affc20000000", + "Body" : "jtfssetdirectoryhttppropertiesjtfssetdirectoryhttpproperties0354466ccdff8fbaeb4Tue, 10 Dec 2019 22:18:16 GMT\"0x8D77DBEDAD0F162\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfssetdirectoryhttpproperties13299405c36839bf494Tue, 10 Dec 2019 22:18:16 GMT\"0x8D77DBEDAE9FC29\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Tue, 10 Dec 2019 22:18:15 GMT", + "x-ms-client-request-id" : "c941c933-4169-4130-86ec-997cdcd97453", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfssetdirectoryhttpproperties0354466ccdff8fbaeb4?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" : "9a5b6e4c-234e-4e9c-b32e-70268378cebf" + }, + "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" : "4944f931-601e-0066-7aa7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:18:16 GMT", + "x-ms-client-request-id" : "9a5b6e4c-234e-4e9c-b32e-70268378cebf" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfssetdirectoryhttpproperties13299405c36839bf494?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" : "a39d903f-86df-407e-8c4b-cc92e09e35cd" + }, + "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" : "4944f942-601e-0066-09a7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:18:16 GMT", + "x-ms-client-request-id" : "a39d903f-86df-407e-8c4b-cc92e09e35cd" + }, + "Exception" : null + } ], + "variables" : [ "jtfssetdirectoryhttpproperties0354466ccdff8fbaeb4", "jtfssetdirectoryhttpproperties13299405c36839bf494", "javapathsetdirectoryhttpproperties27207705ad77b2c2c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestsetdirectorymetadata.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestsetdirectorymetadata.json new file mode 100644 index 000000000000..13da07b38b1f --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestsetdirectorymetadata.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfssetdirectorymetadata09644585c62a38ba8f425f?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" : "b7456159-388e-470d-b65d-3d7a8e09a7de" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DBEC5CEB26B", + "Last-Modified" : "Tue, 10 Dec 2019 22:17:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "4944c1f6-601e-0066-1ca7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:17:40 GMT", + "x-ms-client-request-id" : "b7456159-388e-470d-b65d-3d7a8e09a7de" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfssetdirectorymetadata104362a4763509ffbe483b?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" : "162bc598-653b-46a4-ab92-881b4ff2bafa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DBEC5F72948", + "Last-Modified" : "Tue, 10 Dec 2019 22:17:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "4944c261-601e-0066-7ca7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:17:40 GMT", + "x-ms-client-request-id" : "162bc598-653b-46a4-ab92-881b4ff2bafa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfssetdirectorymetadata104362a4763509ffbe483b/javapathsetdirectorymetadata2732861a8e4f2fcd4b47?comp=metadata", + "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" : "eb10e157-3487-4597-a365-e6082452e61b" + }, + "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", + "Content-Length" : "215", + "StatusCode" : "404", + "x-ms-request-id" : "4944c295-601e-0066-2aa7-affc20000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:4944c295-601e-0066-2aa7-affc20000000\nTime:2019-12-10T22:17:41.6523510Z", + "Date" : "Tue, 10 Dec 2019 22:17:40 GMT", + "x-ms-client-request-id" : "eb10e157-3487-4597-a365-e6082452e61b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://gaprahns.blob.core.windows.net?prefix=jtfssetdirectorymetadata&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" : "63f8b2be-91f3-4a63-b007-82a1ebb2fed1" + }, + "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" : "4944c2ce-601e-0066-5ca7-affc20000000", + "Body" : "jtfssetdirectorymetadatajtfssetdirectorymetadata09644585c62a38ba8f425fTue, 10 Dec 2019 22:17:41 GMT\"0x8D77DBEC5CEB26B\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfssetdirectorymetadata104362a4763509ffbe483bTue, 10 Dec 2019 22:17:41 GMT\"0x8D77DBEC5F72948\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Tue, 10 Dec 2019 22:17:40 GMT", + "x-ms-client-request-id" : "63f8b2be-91f3-4a63-b007-82a1ebb2fed1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfssetdirectorymetadata09644585c62a38ba8f425f?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" : "3fa9b8ea-5975-421d-857d-59c66bea3b9e" + }, + "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" : "4944c2f3-601e-0066-7da7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:17:41 GMT", + "x-ms-client-request-id" : "3fa9b8ea-5975-421d-857d-59c66bea3b9e" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfssetdirectorymetadata104362a4763509ffbe483b?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" : "b9a8a0b7-1437-4649-8f04-2f216405298d" + }, + "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" : "4944c317-601e-0066-1ba7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:17:41 GMT", + "x-ms-client-request-id" : "b9a8a0b7-1437-4649-8f04-2f216405298d" + }, + "Exception" : null + } ], + "variables" : [ "jtfssetdirectorymetadata09644585c62a38ba8f425f", "jtfssetdirectorymetadata104362a4763509ffbe483b", "javapathsetdirectorymetadata2732861a8e4f2fcd4b47" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestsetfilehttpproperties.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestsetfilehttpproperties.json new file mode 100644 index 000000000000..662af99dc37e --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestsetfilehttpproperties.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfssetfilehttpproperties037341d629819ca0a04dc4?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" : "7af0db4d-fdad-4526-9573-0f2f407ee9f6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DBE6198539A", + "Last-Modified" : "Tue, 10 Dec 2019 22:14:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "4943cc30-601e-0066-6da7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:14:52 GMT", + "x-ms-client-request-id" : "7af0db4d-fdad-4526-9573-0f2f407ee9f6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfssetfilehttpproperties183086b7e4fd92426248e8?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" : "886e5b82-df90-4c6f-a8b5-f73c4a6f3ed7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DBE61BA1276", + "Last-Modified" : "Tue, 10 Dec 2019 22:14:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "4943cc88-601e-0066-36a7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:14:52 GMT", + "x-ms-client-request-id" : "886e5b82-df90-4c6f-a8b5-f73c4a6f3ed7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfssetfilehttpproperties183086b7e4fd92426248e8/javapathsetfilehttpproperties2456071a16bec8d0b44e?comp=properties", + "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" : "e90ab8ed-9c57-4cb4-beea-450f6ce1a2a6" + }, + "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", + "Content-Length" : "215", + "StatusCode" : "404", + "x-ms-request-id" : "4943cca8-601e-0066-4da7-affc20000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:4943cca8-601e-0066-4da7-affc20000000\nTime:2019-12-10T22:14:53.4948487Z", + "Date" : "Tue, 10 Dec 2019 22:14:53 GMT", + "x-ms-client-request-id" : "e90ab8ed-9c57-4cb4-beea-450f6ce1a2a6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://gaprahns.blob.core.windows.net?prefix=jtfssetfilehttpproperties&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" : "a6ed7bdf-7b96-419c-90c2-b0bedaa5e3b1" + }, + "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" : "4943ccd0-601e-0066-6fa7-affc20000000", + "Body" : "jtfssetfilehttppropertiesjtfssetfilehttpproperties037341d629819ca0a04dc4Tue, 10 Dec 2019 22:14:53 GMT\"0x8D77DBE6198539A\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfssetfilehttpproperties183086b7e4fd92426248e8Tue, 10 Dec 2019 22:14:53 GMT\"0x8D77DBE61BA1276\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Tue, 10 Dec 2019 22:14:53 GMT", + "x-ms-client-request-id" : "a6ed7bdf-7b96-419c-90c2-b0bedaa5e3b1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfssetfilehttpproperties037341d629819ca0a04dc4?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" : "a7fcd91b-0339-441b-86ca-29a785f848ef" + }, + "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" : "4943cce3-601e-0066-80a7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:14:53 GMT", + "x-ms-client-request-id" : "a7fcd91b-0339-441b-86ca-29a785f848ef" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfssetfilehttpproperties183086b7e4fd92426248e8?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" : "556ee871-5cd9-4ed6-a563-8883079c6bce" + }, + "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" : "4943cd02-601e-0066-1ba7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:14:53 GMT", + "x-ms-client-request-id" : "556ee871-5cd9-4ed6-a563-8883079c6bce" + }, + "Exception" : null + } ], + "variables" : [ "jtfssetfilehttpproperties037341d629819ca0a04dc4", "jtfssetfilehttpproperties183086b7e4fd92426248e8", "javapathsetfilehttpproperties2456071a16bec8d0b44e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestsetfilemetadata.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestsetfilemetadata.json new file mode 100644 index 000000000000..365e82cc6e0b --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestsetfilemetadata.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfssetfilemetadata06388431f266d378c044f5ae0?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" : "b42dd3a9-8dd6-4608-879c-bdb9fd489053" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DBED79DBB28", + "Last-Modified" : "Tue, 10 Dec 2019 22:18:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "4944f10e-601e-0066-1ea7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:18:10 GMT", + "x-ms-client-request-id" : "b42dd3a9-8dd6-4608-879c-bdb9fd489053" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfssetfilemetadata1050001ec8a0f823d54d1eb1d?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" : "132a6a7f-d562-4f5c-98e0-339096e635b5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DBED7B6ED0B", + "Last-Modified" : "Tue, 10 Dec 2019 22:18:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "4944f15c-601e-0066-63a7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:18:10 GMT", + "x-ms-client-request-id" : "132a6a7f-d562-4f5c-98e0-339096e635b5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfssetfilemetadata1050001ec8a0f823d54d1eb1d/javapathsetfilemetadata22580087a638649b284bea8?comp=metadata", + "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" : "6bc069e3-e637-422c-adc2-16fdc14bd5c2" + }, + "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", + "Content-Length" : "215", + "StatusCode" : "404", + "x-ms-request-id" : "4944f184-601e-0066-08a7-affc20000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:4944f184-601e-0066-08a7-affc20000000\nTime:2019-12-10T22:18:11.3893383Z", + "Date" : "Tue, 10 Dec 2019 22:18:10 GMT", + "x-ms-client-request-id" : "6bc069e3-e637-422c-adc2-16fdc14bd5c2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://gaprahns.blob.core.windows.net?prefix=jtfssetfilemetadata&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" : "b00147bf-c803-4953-88e9-0a12ca9eca80" + }, + "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" : "4944f1ad-601e-0066-2ba7-affc20000000", + "Body" : "jtfssetfilemetadatajtfssetfilemetadata06388431f266d378c044f5ae0Tue, 10 Dec 2019 22:18:11 GMT\"0x8D77DBED79DBB28\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfssetfilemetadata1050001ec8a0f823d54d1eb1dTue, 10 Dec 2019 22:18:11 GMT\"0x8D77DBED7B6ED0B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Tue, 10 Dec 2019 22:18:10 GMT", + "x-ms-client-request-id" : "b00147bf-c803-4953-88e9-0a12ca9eca80", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfssetfilemetadata06388431f266d378c044f5ae0?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" : "a5be83c4-14f4-4f5d-90d9-d8387c22f87e" + }, + "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" : "4944f1cb-601e-0066-49a7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:18:10 GMT", + "x-ms-client-request-id" : "a5be83c4-14f4-4f5d-90d9-d8387c22f87e" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfssetfilemetadata1050001ec8a0f823d54d1eb1d?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" : "bd304768-8fed-4e0a-9493-796934fab11b" + }, + "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" : "4944f1df-601e-0066-5aa7-affc20000000", + "Date" : "Tue, 10 Dec 2019 22:18:10 GMT", + "x-ms-client-request-id" : "bd304768-8fed-4e0a-9493-796934fab11b" + }, + "Exception" : null + } ], + "variables" : [ "jtfssetfilemetadata06388431f266d378c044f5ae0", "jtfssetfilemetadata1050001ec8a0f823d54d1eb1d", "javapathsetfilemetadata22580087a638649b284bea8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestsetfilesystemmetadata.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestsetfilesystemmetadata.json new file mode 100644 index 000000000000..1dd7944a57f3 --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestsetfilesystemmetadata.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfssetfilesystemmetadata0722556a05518252de4cd0?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" : "3ad8321b-1a5b-4526-8f82-81e3afd4f40c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DBF6613E7C1", + "Last-Modified" : "Tue, 10 Dec 2019 22:22:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27185bb-401e-0017-40a8-af8e19000000", + "Date" : "Tue, 10 Dec 2019 22:22:09 GMT", + "x-ms-client-request-id" : "3ad8321b-1a5b-4526-8f82-81e3afd4f40c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfssetfilesystemmetadata1793568b28d792245d41b7?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" : "0693d7e0-9a86-4dfa-8bac-5a5510e23100" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DBF662EA081", + "Last-Modified" : "Tue, 10 Dec 2019 22:22:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27185f7-401e-0017-6fa8-af8e19000000", + "Date" : "Tue, 10 Dec 2019 22:22:09 GMT", + "x-ms-client-request-id" : "0693d7e0-9a86-4dfa-8bac-5a5510e23100" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfssetfilesystemmetadata2491059416a78e8bad4da9?restype=container&comp=metadata", + "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" : "05be8e55-3fe9-4b9a-a0a0-680dc3aea6a3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "e2718614-401e-0017-08a8-af8e19000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:e2718614-401e-0017-08a8-af8e19000000\nTime:2019-12-10T22:22:10.3772540Z", + "Date" : "Tue, 10 Dec 2019 22:22:09 GMT", + "x-ms-client-request-id" : "05be8e55-3fe9-4b9a-a0a0-680dc3aea6a3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://gaprahns.blob.core.windows.net?prefix=jtfssetfilesystemmetadata&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" : "5859b644-1495-456e-b08e-dac3b998e7ef" + }, + "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" : "e271863a-401e-0017-25a8-af8e19000000", + "Body" : "jtfssetfilesystemmetadatajtfssetfilesystemmetadata0722556a05518252de4cd0Tue, 10 Dec 2019 22:22:10 GMT\"0x8D77DBF6613E7C1\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfssetfilesystemmetadata1793568b28d792245d41b7Tue, 10 Dec 2019 22:22:10 GMT\"0x8D77DBF662EA081\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Tue, 10 Dec 2019 22:22:09 GMT", + "x-ms-client-request-id" : "5859b644-1495-456e-b08e-dac3b998e7ef", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfssetfilesystemmetadata0722556a05518252de4cd0?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" : "79257cc7-357f-4adc-85a3-d2e0b3a22966" + }, + "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" : "e271864d-401e-0017-35a8-af8e19000000", + "Date" : "Tue, 10 Dec 2019 22:22:10 GMT", + "x-ms-client-request-id" : "79257cc7-357f-4adc-85a3-d2e0b3a22966" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfssetfilesystemmetadata1793568b28d792245d41b7?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" : "d43e7ab7-d509-4a17-a865-d38077dcf18c" + }, + "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" : "e2718664-401e-0017-47a8-af8e19000000", + "Date" : "Tue, 10 Dec 2019 22:22:10 GMT", + "x-ms-client-request-id" : "d43e7ab7-d509-4a17-a865-d38077dcf18c" + }, + "Exception" : null + } ], + "variables" : [ "jtfssetfilesystemmetadata0722556a05518252de4cd0", "jtfssetfilesystemmetadata1793568b28d792245d41b7", "jtfssetfilesystemmetadata2491059416a78e8bad4da9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/LeaseAsyncErrorMappingTestacquirelease.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/LeaseAsyncErrorMappingTestacquirelease.json new file mode 100644 index 000000000000..aae4d59aa87e --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/LeaseAsyncErrorMappingTestacquirelease.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsacquirelease02113312720c122e6144a9a1b3?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" : "d885cc46-ec44-4be2-a481-d677338d332a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DC12D9CAF8D", + "Last-Modified" : "Tue, 10 Dec 2019 22:34:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "80aa5d3b-201e-00e9-3aaa-afb27c000000", + "Date" : "Tue, 10 Dec 2019 22:34:54 GMT", + "x-ms-client-request-id" : "d885cc46-ec44-4be2-a481-d677338d332a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsacquirelease16852841b3c19937864b2fa0f7?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" : "a524718c-9dbc-4024-adf8-8673680cff35" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DC12DC37166", + "Last-Modified" : "Tue, 10 Dec 2019 22:34:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "80aa5dda-201e-00e9-48aa-afb27c000000", + "Date" : "Tue, 10 Dec 2019 22:34:54 GMT", + "x-ms-client-request-id" : "a524718c-9dbc-4024-adf8-8673680cff35" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsacquirelease16852841b3c19937864b2fa0f7/javapathacquirelease28717976ee780e23db4febaa?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file-datalake/12.0.0-preview.7 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "8db5cb13-e462-44c1-9be3-1975456e047f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "328", + "StatusCode" : "400", + "x-ms-request-id" : "80aa5e2f-201e-00e9-18aa-afb27c000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:80aa5e2f-201e-00e9-18aa-afb27c000000\nTime:2019-12-10T22:34:54.7347941Zx-ms-lease-duration-10", + "Date" : "Tue, 10 Dec 2019 22:34:54 GMT", + "x-ms-client-request-id" : "8db5cb13-e462-44c1-9be3-1975456e047f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://gaprahns.blob.core.windows.net?prefix=jtfsacquirelease&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" : "7db20438-3a9d-476c-90b2-ed9424d991cd" + }, + "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" : "80aa5e6e-201e-00e9-56aa-afb27c000000", + "Body" : "jtfsacquireleasejtfsacquirelease02113312720c122e6144a9a1b3Tue, 10 Dec 2019 22:34:54 GMT\"0x8D77DC12D9CAF8D\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfsacquirelease16852841b3c19937864b2fa0f7Tue, 10 Dec 2019 22:34:54 GMT\"0x8D77DC12DC37166\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Tue, 10 Dec 2019 22:34:54 GMT", + "x-ms-client-request-id" : "7db20438-3a9d-476c-90b2-ed9424d991cd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsacquirelease02113312720c122e6144a9a1b3?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" : "894accc7-e709-42c1-a2f1-ec4bfa958945" + }, + "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" : "80aa5e8f-201e-00e9-76aa-afb27c000000", + "Date" : "Tue, 10 Dec 2019 22:34:54 GMT", + "x-ms-client-request-id" : "894accc7-e709-42c1-a2f1-ec4bfa958945" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsacquirelease16852841b3c19937864b2fa0f7?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" : "2f7dd999-eea6-4fbc-b022-eab05f89d7c0" + }, + "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" : "80aa5eb2-201e-00e9-18aa-afb27c000000", + "Date" : "Tue, 10 Dec 2019 22:34:54 GMT", + "x-ms-client-request-id" : "2f7dd999-eea6-4fbc-b022-eab05f89d7c0" + }, + "Exception" : null + } ], + "variables" : [ "jtfsacquirelease02113312720c122e6144a9a1b3", "jtfsacquirelease16852841b3c19937864b2fa0f7", "javapathacquirelease28717976ee780e23db4febaa" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/LeaseAsyncErrorMappingTestbreaklease.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/LeaseAsyncErrorMappingTestbreaklease.json new file mode 100644 index 000000000000..49f96101dcae --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/LeaseAsyncErrorMappingTestbreaklease.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsbreaklease0leaseasyncerrormappingtestbreaklease7b15307458?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" : "05bdd149-4d39-467c-8a1f-35aa0a1991f8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DC15BB01D26", + "Last-Modified" : "Tue, 10 Dec 2019 22:36:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "80ab00da-201e-00e9-67aa-afb27c000000", + "Date" : "Tue, 10 Dec 2019 22:36:11 GMT", + "x-ms-client-request-id" : "05bdd149-4d39-467c-8a1f-35aa0a1991f8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsbreaklease1leaseasyncerrormappingtestbreaklease7b12340351?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" : "512ba361-411d-426e-82d4-6868ed9c304e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DC15BC81247", + "Last-Modified" : "Tue, 10 Dec 2019 22:36:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "80ab013c-201e-00e9-41aa-afb27c000000", + "Date" : "Tue, 10 Dec 2019 22:36:11 GMT", + "x-ms-client-request-id" : "512ba361-411d-426e-82d4-6868ed9c304e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsbreaklease1leaseasyncerrormappingtestbreaklease7b12340351/javapathbreaklease29497173800ab772ec4bc4a59?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file-datalake/12.0.0-preview.7 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "d2e6c18e-c807-4f3e-9074-369608f1acc8" + }, + "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", + "Content-Length" : "215", + "StatusCode" : "404", + "x-ms-request-id" : "80ab017c-201e-00e9-7eaa-afb27c000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:80ab017c-201e-00e9-7eaa-afb27c000000\nTime:2019-12-10T22:36:11.9843201Z", + "Date" : "Tue, 10 Dec 2019 22:36:11 GMT", + "x-ms-client-request-id" : "d2e6c18e-c807-4f3e-9074-369608f1acc8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://gaprahns.blob.core.windows.net?prefix=jtfsbreaklease&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" : "987011c1-1993-4839-ab91-1d857534da6e" + }, + "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" : "80ab01c7-201e-00e9-40aa-afb27c000000", + "Body" : "jtfsbreakleasejtfsbreaklease0leaseasyncerrormappingtestbreaklease7b15307458Tue, 10 Dec 2019 22:36:11 GMT\"0x8D77DC15BB01D26\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfsbreaklease1leaseasyncerrormappingtestbreaklease7b12340351Tue, 10 Dec 2019 22:36:11 GMT\"0x8D77DC15BC81247\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Tue, 10 Dec 2019 22:36:11 GMT", + "x-ms-client-request-id" : "987011c1-1993-4839-ab91-1d857534da6e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsbreaklease0leaseasyncerrormappingtestbreaklease7b15307458?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" : "c3494482-66a4-4614-b0b8-8063e0150357" + }, + "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" : "80ab01ea-201e-00e9-5faa-afb27c000000", + "Date" : "Tue, 10 Dec 2019 22:36:11 GMT", + "x-ms-client-request-id" : "c3494482-66a4-4614-b0b8-8063e0150357" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsbreaklease1leaseasyncerrormappingtestbreaklease7b12340351?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" : "c85b26c9-a881-4c78-bbc7-fb2dfc7a3b4a" + }, + "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" : "80ab0206-201e-00e9-79aa-afb27c000000", + "Date" : "Tue, 10 Dec 2019 22:36:11 GMT", + "x-ms-client-request-id" : "c85b26c9-a881-4c78-bbc7-fb2dfc7a3b4a" + }, + "Exception" : null + } ], + "variables" : [ "jtfsbreaklease0leaseasyncerrormappingtestbreaklease7b15307458", "jtfsbreaklease1leaseasyncerrormappingtestbreaklease7b12340351", "javapathbreaklease29497173800ab772ec4bc4a59" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/LeaseAsyncErrorMappingTestchangelease.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/LeaseAsyncErrorMappingTestchangelease.json new file mode 100644 index 000000000000..f140a4fa4632 --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/LeaseAsyncErrorMappingTestchangelease.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfschangelease0leaseasyncerrormappingtestchangeleaseaea163808?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" : "f518f3ca-4335-4e15-a85a-bd610e2e71c8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DC14E1A913C", + "Last-Modified" : "Tue, 10 Dec 2019 22:35:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "80aace8d-201e-00e9-80aa-afb27c000000", + "Date" : "Tue, 10 Dec 2019 22:35:48 GMT", + "x-ms-client-request-id" : "f518f3ca-4335-4e15-a85a-bd610e2e71c8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfschangelease1leaseasyncerrormappingtestchangeleaseaea16133a?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" : "079a95b5-e8f2-4dc7-9b72-f82cdd708790" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DC14E33709E", + "Last-Modified" : "Tue, 10 Dec 2019 22:35:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "80aacee7-201e-00e9-4aaa-afb27c000000", + "Date" : "Tue, 10 Dec 2019 22:35:48 GMT", + "x-ms-client-request-id" : "079a95b5-e8f2-4dc7-9b72-f82cdd708790" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfschangelease1leaseasyncerrormappingtestchangeleaseaea16133a/javapathchangelease254080bee61464ab3f4e05834?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file-datalake/12.0.0-preview.7 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "659247e2-d81c-4ea5-b029-83eddade3e42" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "MissingRequiredHeader", + "retry-after" : "0", + "Content-Length" : "303", + "StatusCode" : "400", + "x-ms-request-id" : "80aacf30-201e-00e9-0baa-afb27c000000", + "Body" : "MissingRequiredHeaderAn HTTP header that's mandatory for this request is not specified.\nRequestId:80aacf30-201e-00e9-0baa-afb27c000000\nTime:2019-12-10T22:35:49.1648670Zx-ms-proposed-lease-id", + "Date" : "Tue, 10 Dec 2019 22:35:48 GMT", + "x-ms-client-request-id" : "659247e2-d81c-4ea5-b029-83eddade3e42", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://gaprahns.blob.core.windows.net?prefix=jtfschangelease&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" : "75e7bc29-95f5-43b8-b581-d3edee514f5b" + }, + "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" : "80aacf7d-201e-00e9-4eaa-afb27c000000", + "Body" : "jtfschangeleasejtfschangelease0leaseasyncerrormappingtestchangeleaseaea163808Tue, 10 Dec 2019 22:35:48 GMT\"0x8D77DC14E1A913C\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfschangelease1leaseasyncerrormappingtestchangeleaseaea16133aTue, 10 Dec 2019 22:35:49 GMT\"0x8D77DC14E33709E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Tue, 10 Dec 2019 22:35:48 GMT", + "x-ms-client-request-id" : "75e7bc29-95f5-43b8-b581-d3edee514f5b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfschangelease0leaseasyncerrormappingtestchangeleaseaea163808?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" : "30b707ae-58fc-4943-89a1-bff04ca634f6" + }, + "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" : "80aacfa7-201e-00e9-73aa-afb27c000000", + "Date" : "Tue, 10 Dec 2019 22:35:49 GMT", + "x-ms-client-request-id" : "30b707ae-58fc-4943-89a1-bff04ca634f6" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfschangelease1leaseasyncerrormappingtestchangeleaseaea16133a?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" : "499abe5b-38b6-4e7e-9513-d0113f1df7c2" + }, + "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" : "80aacfc1-201e-00e9-0aaa-afb27c000000", + "Date" : "Tue, 10 Dec 2019 22:35:49 GMT", + "x-ms-client-request-id" : "499abe5b-38b6-4e7e-9513-d0113f1df7c2" + }, + "Exception" : null + } ], + "variables" : [ "jtfschangelease0leaseasyncerrormappingtestchangeleaseaea163808", "jtfschangelease1leaseasyncerrormappingtestchangeleaseaea16133a", "javapathchangelease254080bee61464ab3f4e05834" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/LeaseAsyncErrorMappingTestreleaselease.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/LeaseAsyncErrorMappingTestreleaselease.json new file mode 100644 index 000000000000..1dbca91af79c --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/LeaseAsyncErrorMappingTestreleaselease.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsreleaselease028489a8d46f945851407b9de7?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" : "d3a19b25-37f1-4303-a2dc-961e7aa364e7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DC13FBE5909", + "Last-Modified" : "Tue, 10 Dec 2019 22:35:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "80aa9bc2-201e-00e9-50aa-afb27c000000", + "Date" : "Tue, 10 Dec 2019 22:35:24 GMT", + "x-ms-client-request-id" : "d3a19b25-37f1-4303-a2dc-961e7aa364e7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsreleaselease1904156d22e1f8f03e47e5ac2e?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" : "1893d59c-e34a-4322-8344-edf65232a941" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DC13FD8E5E3", + "Last-Modified" : "Tue, 10 Dec 2019 22:35:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "80aa9c15-201e-00e9-13aa-afb27c000000", + "Date" : "Tue, 10 Dec 2019 22:35:24 GMT", + "x-ms-client-request-id" : "1893d59c-e34a-4322-8344-edf65232a941" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsreleaselease1904156d22e1f8f03e47e5ac2e/javapathreleaselease279161810d2baa1830465097?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file-datalake/12.0.0-preview.7 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "387a1dc6-98c5-4253-96e4-4855beba368e" + }, + "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", + "Content-Length" : "215", + "StatusCode" : "404", + "x-ms-request-id" : "80aa9c5b-201e-00e9-4daa-afb27c000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:80aa9c5b-201e-00e9-4daa-afb27c000000\nTime:2019-12-10T22:35:25.1133956Z", + "Date" : "Tue, 10 Dec 2019 22:35:24 GMT", + "x-ms-client-request-id" : "387a1dc6-98c5-4253-96e4-4855beba368e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://gaprahns.blob.core.windows.net?prefix=jtfsreleaselease&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" : "ac741296-802b-4197-b5a5-d4fd917850a6" + }, + "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" : "80aa9cbc-201e-00e9-26aa-afb27c000000", + "Body" : "jtfsreleaseleasejtfsreleaselease028489a8d46f945851407b9de7Tue, 10 Dec 2019 22:35:24 GMT\"0x8D77DC13FBE5909\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfsreleaselease1904156d22e1f8f03e47e5ac2eTue, 10 Dec 2019 22:35:24 GMT\"0x8D77DC13FD8E5E3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Tue, 10 Dec 2019 22:35:24 GMT", + "x-ms-client-request-id" : "ac741296-802b-4197-b5a5-d4fd917850a6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsreleaselease028489a8d46f945851407b9de7?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" : "d3a1323c-8899-46a9-b38b-b07937812733" + }, + "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" : "80aa9cff-201e-00e9-64aa-afb27c000000", + "Date" : "Tue, 10 Dec 2019 22:35:25 GMT", + "x-ms-client-request-id" : "d3a1323c-8899-46a9-b38b-b07937812733" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsreleaselease1904156d22e1f8f03e47e5ac2e?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" : "15191cd6-7969-4bea-9ed4-d1a33a76c8d2" + }, + "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" : "80aa9d1a-201e-00e9-7faa-afb27c000000", + "Date" : "Tue, 10 Dec 2019 22:35:25 GMT", + "x-ms-client-request-id" : "15191cd6-7969-4bea-9ed4-d1a33a76c8d2" + }, + "Exception" : null + } ], + "variables" : [ "jtfsreleaselease028489a8d46f945851407b9de7", "jtfsreleaselease1904156d22e1f8f03e47e5ac2e", "javapathreleaselease279161810d2baa1830465097" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/LeaseAsyncErrorMappingTestrenewlease.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/LeaseAsyncErrorMappingTestrenewlease.json new file mode 100644 index 000000000000..9b2fdf3d2c32 --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/LeaseAsyncErrorMappingTestrenewlease.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsrenewlease0leaseasyncerrormappingtestrenewleasec7e26581fc?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" : "c027df60-0e56-432b-81b9-4e6cd2e17bb0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DC1310692A8", + "Last-Modified" : "Tue, 10 Dec 2019 22:35:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "80aa6976-201e-00e9-31aa-afb27c000000", + "Date" : "Tue, 10 Dec 2019 22:34:59 GMT", + "x-ms-client-request-id" : "c027df60-0e56-432b-81b9-4e6cd2e17bb0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsrenewlease1leaseasyncerrormappingtestrenewleasec7e7174173?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" : "7e826641-2592-4711-a4f8-bad1dbf0515e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77DC1311FE727", + "Last-Modified" : "Tue, 10 Dec 2019 22:35:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "80aa69cd-201e-00e9-7caa-afb27c000000", + "Date" : "Tue, 10 Dec 2019 22:34:59 GMT", + "x-ms-client-request-id" : "7e826641-2592-4711-a4f8-bad1dbf0515e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsrenewlease1leaseasyncerrormappingtestrenewleasec7e7174173/javapathrenewlease2284788d0fc3edc1f741febb4?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file-datalake/12.0.0-preview.7 (11.0.4; Windows 10 10.0)", + "x-ms-client-request-id" : "06a23a8e-d5bf-4bff-9ac4-d7779810135d" + }, + "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", + "Content-Length" : "215", + "StatusCode" : "404", + "x-ms-request-id" : "80aa6a0b-201e-00e9-36aa-afb27c000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:80aa6a0b-201e-00e9-36aa-afb27c000000\nTime:2019-12-10T22:35:00.4409099Z", + "Date" : "Tue, 10 Dec 2019 22:35:00 GMT", + "x-ms-client-request-id" : "06a23a8e-d5bf-4bff-9ac4-d7779810135d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://gaprahns.blob.core.windows.net?prefix=jtfsrenewlease&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" : "d96c194f-18cc-4be9-b85e-c874de105ed2" + }, + "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" : "80aa6a93-201e-00e9-2baa-afb27c000000", + "Body" : "jtfsrenewleasejtfsrenewlease0leaseasyncerrormappingtestrenewleasec7e26581fcTue, 10 Dec 2019 22:35:00 GMT\"0x8D77DC1310692A8\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfsrenewlease1leaseasyncerrormappingtestrenewleasec7e7174173Tue, 10 Dec 2019 22:35:00 GMT\"0x8D77DC1311FE727\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Tue, 10 Dec 2019 22:35:00 GMT", + "x-ms-client-request-id" : "d96c194f-18cc-4be9-b85e-c874de105ed2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsrenewlease0leaseasyncerrormappingtestrenewleasec7e26581fc?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" : "306233cb-54fc-444f-aa6b-a6ecc49b6c7a" + }, + "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" : "80aa6af9-201e-00e9-01aa-afb27c000000", + "Date" : "Tue, 10 Dec 2019 22:35:00 GMT", + "x-ms-client-request-id" : "306233cb-54fc-444f-aa6b-a6ecc49b6c7a" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gaprahns.blob.core.windows.net/jtfsrenewlease1leaseasyncerrormappingtestrenewleasec7e7174173?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" : "9988c81e-808b-4a01-ada7-b12e51fcaec8" + }, + "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" : "80aa6b27-201e-00e9-2baa-afb27c000000", + "Date" : "Tue, 10 Dec 2019 22:35:00 GMT", + "x-ms-client-request-id" : "9988c81e-808b-4a01-ada7-b12e51fcaec8" + }, + "Exception" : null + } ], + "variables" : [ "jtfsrenewlease0leaseasyncerrormappingtestrenewleasec7e26581fc", "jtfsrenewlease1leaseasyncerrormappingtestrenewleasec7e7174173", "javapathrenewlease2284788d0fc3edc1f741febb4" ] +} \ No newline at end of file From abafcc49c4a30bff5b4d448420063822f912360f Mon Sep 17 00:00:00 2001 From: Gauri Prasad Date: Wed, 11 Dec 2019 11:40:38 -0800 Subject: [PATCH 03/12] Finalized tests and fixed analyze step --- .../datalake/DataLakeFileAsyncClient.java | 3 +-- .../DataLakeFileSystemAsyncClient.java | 12 +++++----- .../datalake/DataLakeFileSystemClient.java | 5 ++--- .../file/datalake/DataLakePathClient.java | 1 - .../datalake/DataLakeServiceAsyncClient.java | 2 +- .../file/datalake/DataLakeServiceClient.java | 1 - .../util/DataLakeImplUtils.java | 20 +++++++++++++++-- .../datalake/AsyncErrorMappingTest.groovy | 22 +++++++++++++++++++ .../file/datalake/ServiceAPITest.groovy | 11 ++++++++-- 9 files changed, 60 insertions(+), 17 deletions(-) diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileAsyncClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileAsyncClient.java index ac22d9f76c96..bf6b985a94e7 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileAsyncClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileAsyncClient.java @@ -11,7 +11,6 @@ import com.azure.core.util.FluxUtil; import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.BlobContainerAsyncClient; -import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.blob.specialized.BlockBlobAsyncClient; import com.azure.storage.file.datalake.implementation.models.LeaseAccessConditions; import com.azure.storage.file.datalake.implementation.models.ModifiedAccessConditions; @@ -331,7 +330,7 @@ public Mono readWithResponse(FileRange range, DownloadRet return blockBlobAsyncClient.downloadWithResponse(Transforms.toBlobRange(range), Transforms.toBlobDownloadRetryOptions(options), Transforms.toBlobRequestConditions(requestConditions), getRangeContentMd5).map(Transforms::toFileReadAsyncResponse) - .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)); + .onErrorMap(DataLakeImplUtils::transformBlobStorageException); } catch (RuntimeException ex) { return monoError(logger, ex); } diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemAsyncClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemAsyncClient.java index 5ec434991819..920c762d084a 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemAsyncClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemAsyncClient.java @@ -244,7 +244,7 @@ public Mono create() { public Mono> createWithResponse(Map metadata, PublicAccessType accessType) { try { return blobContainerAsyncClient.createWithResponse(metadata, Transforms.toBlobPublicAccessType(accessType)) - .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)); + .onErrorMap(DataLakeImplUtils::transformBlobStorageException); } catch (RuntimeException ex) { return monoError(logger, ex); } @@ -287,7 +287,7 @@ public Mono> deleteWithResponse(DataLakeRequestConditions request try { return blobContainerAsyncClient.deleteWithResponse( Transforms.toBlobRequestConditions(requestConditions)) - .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)); + .onErrorMap(DataLakeImplUtils::transformBlobStorageException); } catch (RuntimeException ex) { return monoError(logger, ex); } @@ -326,7 +326,7 @@ public Mono getProperties() { public Mono> getPropertiesWithResponse(String leaseId) { try { return blobContainerAsyncClient.getPropertiesWithResponse(leaseId) - .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)) + .onErrorMap(DataLakeImplUtils::transformBlobStorageException) .map(response -> new SimpleResponse<>(response, Transforms.toFileSystemProperties(response.getValue()))); } catch (RuntimeException ex) { @@ -374,7 +374,7 @@ public Mono> setMetadataWithResponse(Map metadata try { return blobContainerAsyncClient.setMetadataWithResponse(metadata, Transforms.toBlobRequestConditions(requestConditions)) - .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)); + .onErrorMap(DataLakeImplUtils::transformBlobStorageException); } catch (RuntimeException ex) { return monoError(logger, ex); } @@ -670,7 +670,8 @@ public Mono> setAccessPolicyWithResponse(PublicAccessType accessT List identifiers, DataLakeRequestConditions requestConditions) { try { return blobContainerAsyncClient.setAccessPolicyWithResponse(Transforms.toBlobPublicAccessType(accessType), - Transforms.toBlobIdentifierList(identifiers), Transforms.toBlobRequestConditions(requestConditions)); + Transforms.toBlobIdentifierList(identifiers), Transforms.toBlobRequestConditions(requestConditions)) + .onErrorMap(DataLakeImplUtils::transformBlobStorageException); } catch (RuntimeException ex) { return monoError(logger, ex); } @@ -710,6 +711,7 @@ public Mono getAccessPolicy() { public Mono> getAccessPolicyWithResponse(String leaseId) { try { return blobContainerAsyncClient.getAccessPolicyWithResponse(leaseId) + .onErrorMap(DataLakeImplUtils::transformBlobStorageException) .map(response -> new SimpleResponse<>(response, Transforms.toFileSystemAccessPolicies(response.getValue()))); } catch (RuntimeException ex) { diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemClient.java index 43b004594601..4151f41cc5bc 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemClient.java @@ -198,12 +198,11 @@ public void create() { public Response createWithResponse(Map metadata, PublicAccessType accessType, Duration timeout, Context context) { try { - return blobContainerClient.createWithResponse(metadata, Transforms.toBlobPublicAccessType(accessType), timeout, - context); + return blobContainerClient.createWithResponse(metadata, Transforms.toBlobPublicAccessType(accessType), + timeout, context); } catch (BlobStorageException ex) { throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); } - } /** 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 2452363f9e91..694f86d25d32 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 @@ -19,7 +19,6 @@ import com.azure.storage.file.datalake.implementation.models.SourceModifiedAccessConditions; import com.azure.storage.file.datalake.implementation.util.DataLakeImplUtils; import com.azure.storage.file.datalake.models.DataLakeRequestConditions; -import com.azure.storage.file.datalake.models.DataLakeStorageException; import com.azure.storage.file.datalake.models.PathAccessControl; import com.azure.storage.file.datalake.models.PathAccessControlEntry; import com.azure.storage.file.datalake.models.PathHttpHeaders; diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceAsyncClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceAsyncClient.java index 2e89bac34ede..c80b8a4c0572 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceAsyncClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceAsyncClient.java @@ -306,7 +306,7 @@ public Mono> getUserDelegationKeyWithResponse(Offset OffsetDateTime expiry) { try { return blobServiceAsyncClient.getUserDelegationKeyWithResponse(start, expiry) - .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)) + .onErrorMap(DataLakeImplUtils::transformBlobStorageException) .map(response -> new SimpleResponse<>(response, Transforms.toDataLakeUserDelegationKey(response.getValue()))); } catch (RuntimeException ex) { diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceClient.java index a73a2df9d0e8..b1511dcf208e 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceClient.java @@ -12,7 +12,6 @@ import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.BlobServiceClient; -import com.azure.storage.blob.models.BlobContainerItem; import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.common.StorageSharedKeyCredential; import com.azure.storage.common.sas.AccountSasSignatureValues; diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/DataLakeImplUtils.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/DataLakeImplUtils.java index d78940449e01..40ae866df0b2 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/DataLakeImplUtils.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/DataLakeImplUtils.java @@ -18,7 +18,23 @@ public static String endpointToDesiredEndpoint(String endpoint, String desiredEn } } - public static DataLakeStorageException transformBlobStorageException(BlobStorageException ex) { - return new DataLakeStorageException(ex.getServiceMessage(), ex.getResponse(), ex.getValue()); + public static RuntimeException transformBlobStorageException(RuntimeException ex) { + if (!(ex instanceof BlobStorageException)) { + return ex; + } else { + BlobStorageException exception = (BlobStorageException) ex; + return new DataLakeStorageException(exception.getServiceMessage(), exception.getResponse(), + exception.getValue()); + } + } + + public static Throwable transformBlobStorageException(Throwable ex) { + if (!(ex instanceof BlobStorageException)) { + return ex; + } else { + BlobStorageException exception = (BlobStorageException) ex; + return new DataLakeStorageException(exception.getServiceMessage(), exception.getResponse(), + exception.getValue()); + } } } diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/AsyncErrorMappingTest.groovy b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/AsyncErrorMappingTest.groovy index 17447e6d84d6..26df051a64c8 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/AsyncErrorMappingTest.groovy +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/AsyncErrorMappingTest.groovy @@ -133,4 +133,26 @@ class AsyncErrorMappingTest extends APISpec { } } + def "Get file system access policy"() { + when: + def fileSystemName = generateFileSystemName() + def fsac = getServiceAsyncClient(primaryCredential).getFileSystemAsyncClient(fileSystemName) + def getAccessPolicyVerifier = StepVerifier.create(fsac.getAccessPolicyWithResponse(null)) + then: + getAccessPolicyVerifier.verifyErrorSatisfies { + assert it instanceof DataLakeStorageException + } + } + + def "Set file system access policy"() { + when: + def fileSystemName = generateFileSystemName() + def fsac = getServiceAsyncClient(primaryCredential).getFileSystemAsyncClient(fileSystemName) + def setAccessPolicyVerifier = StepVerifier.create(fsac.setAccessPolicyWithResponse(null, null, null)) + then: + setAccessPolicyVerifier.verifyErrorSatisfies { + assert it instanceof DataLakeStorageException + } + } + } diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/ServiceAPITest.groovy b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/ServiceAPITest.groovy index e7517df163cf..9184cba3500b 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/ServiceAPITest.groovy +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/ServiceAPITest.groovy @@ -7,7 +7,9 @@ import com.azure.core.http.rest.PagedIterable import com.azure.core.http.rest.Response import com.azure.identity.DefaultAzureCredentialBuilder import com.azure.storage.blob.BlobUrlParts +import com.azure.storage.blob.models.BlobContainerItem import com.azure.storage.blob.models.BlobStorageException +import com.azure.storage.file.datalake.implementation.util.DataLakeImplUtils import com.azure.storage.file.datalake.models.DataLakeStorageException import com.azure.storage.file.datalake.models.FileSystemItem import com.azure.storage.file.datalake.models.FileSystemListDetails @@ -100,10 +102,15 @@ class ServiceAPITest extends APISpec { def "List file systems error"() { when: - primaryDataLakeServiceClient.listFileSystems().streamByPage("garbage continuation token").count() + PagedIterable items = primaryDataLakeServiceClient.listFileSystems() + try { + items.streamByPage("garbage continuation token").count() + } catch (BlobStorageException ex) { + throw DataLakeImplUtils.transformBlobStorageException(ex) + } then: - thrown(BlobStorageException) + thrown(DataLakeStorageException) } def "List file systems with timeout still backed by PagedFlux"() { From a40b477a0f8d14b97835187c505f1a551f259925 Mon Sep 17 00:00:00 2001 From: Gauri Prasad Date: Wed, 11 Dec 2019 11:51:26 -0800 Subject: [PATCH 04/12] Fixed unused imports --- .../storage/file/datalake/DataLakeFileSystemAsyncClient.java | 1 - .../azure/storage/file/datalake/DataLakeServiceAsyncClient.java | 1 - 2 files changed, 2 deletions(-) diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemAsyncClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemAsyncClient.java index 920c762d084a..770d699f8cb3 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemAsyncClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemAsyncClient.java @@ -14,7 +14,6 @@ import com.azure.core.util.FluxUtil; import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.BlobContainerAsyncClient; -import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.blob.specialized.BlockBlobAsyncClient; import com.azure.storage.common.StorageSharedKeyCredential; import com.azure.storage.common.Utility; diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceAsyncClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceAsyncClient.java index c80b8a4c0572..368128ba73a5 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceAsyncClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceAsyncClient.java @@ -13,7 +13,6 @@ import com.azure.core.util.FluxUtil; import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.BlobServiceAsyncClient; -import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.common.StorageSharedKeyCredential; import com.azure.storage.common.Utility; import com.azure.storage.common.implementation.StorageImplUtils; From faad5aabb8fc4dba5d7d244c0ccccb6b775e0d0b Mon Sep 17 00:00:00 2001 From: Gauri Prasad Date: Wed, 11 Dec 2019 11:52:48 -0800 Subject: [PATCH 05/12] Added test recordings --- ...rMappingTestgetfilesystemaccesspolicy.json | 127 +++++++++++++++++ ...rMappingTestsetfilesystemaccesspolicy.json | 128 ++++++++++++++++++ 2 files changed, 255 insertions(+) create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestgetfilesystemaccesspolicy.json create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestsetfilesystemaccesspolicy.json diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestgetfilesystemaccesspolicy.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestgetfilesystemaccesspolicy.json new file mode 100644 index 000000000000..c1486d57b82c --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestgetfilesystemaccesspolicy.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gaprahns.blob.core.windows.net/jtfsgetfilesystemaccesspolicy08823810338c8890a242?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" : "9215a725-0a9e-4b07-8725-5a34d1429a19" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77E5A23AABD9E", + "Last-Modified" : "Wed, 11 Dec 2019 16:49:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d309d08-501e-00ed-5443-b047fe000000", + "Date" : "Wed, 11 Dec 2019 16:49:50 GMT", + "x-ms-client-request-id" : "9215a725-0a9e-4b07-8725-5a34d1429a19" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gaprahns.blob.core.windows.net/jtfsgetfilesystemaccesspolicy180390e03b1642bd2c43?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" : "cb6a66fb-e169-47d8-a424-2bfb38e78815" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77E5A23DC7C4A", + "Last-Modified" : "Wed, 11 Dec 2019 16:49:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d309da8-501e-00ed-6143-b047fe000000", + "Date" : "Wed, 11 Dec 2019 16:49:50 GMT", + "x-ms-client-request-id" : "cb6a66fb-e169-47d8-a424-2bfb38e78815" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gaprahns.blob.core.windows.net/jtfsgetfilesystemaccesspolicy273895eb9dc939004c43?restype=container&comp=acl", + "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" : "98b2418a-d4e7-4eec-8254-62df3383352c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "6d309dd0-501e-00ed-0543-b047fe000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:6d309dd0-501e-00ed-0543-b047fe000000\nTime:2019-12-11T16:49:51.1033309Z", + "Date" : "Wed, 11 Dec 2019 16:49:50 GMT", + "x-ms-client-request-id" : "98b2418a-d4e7-4eec-8254-62df3383352c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gaprahns.blob.core.windows.net?prefix=jtfsgetfilesystemaccesspolicy&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" : "ca6d548f-d1eb-470c-83dc-fd2e2267af72" + }, + "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" : "6d309e21-501e-00ed-4a43-b047fe000000", + "Body" : "jtfsgetfilesystemaccesspolicyjtfsgetfilesystemaccesspolicy08823810338c8890a242Wed, 11 Dec 2019 16:49:50 GMT\"0x8D77E5A23AABD9E\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfsgetfilesystemaccesspolicy180390e03b1642bd2c43Wed, 11 Dec 2019 16:49:51 GMT\"0x8D77E5A23DC7C4A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Wed, 11 Dec 2019 16:49:51 GMT", + "x-ms-client-request-id" : "ca6d548f-d1eb-470c-83dc-fd2e2267af72", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gaprahns.blob.core.windows.net/jtfsgetfilesystemaccesspolicy08823810338c8890a242?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" : "4e471bc3-776c-45b6-97eb-3ce8bae06902" + }, + "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" : "6d309e5f-501e-00ed-0443-b047fe000000", + "Date" : "Wed, 11 Dec 2019 16:49:51 GMT", + "x-ms-client-request-id" : "4e471bc3-776c-45b6-97eb-3ce8bae06902" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gaprahns.blob.core.windows.net/jtfsgetfilesystemaccesspolicy180390e03b1642bd2c43?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" : "44ee409f-7ebf-449c-9825-3ff128c67496" + }, + "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" : "6d309e73-501e-00ed-1743-b047fe000000", + "Date" : "Wed, 11 Dec 2019 16:49:51 GMT", + "x-ms-client-request-id" : "44ee409f-7ebf-449c-9825-3ff128c67496" + }, + "Exception" : null + } ], + "variables" : [ "jtfsgetfilesystemaccesspolicy08823810338c8890a242", "jtfsgetfilesystemaccesspolicy180390e03b1642bd2c43", "jtfsgetfilesystemaccesspolicy273895eb9dc939004c43" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestsetfilesystemaccesspolicy.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestsetfilesystemaccesspolicy.json new file mode 100644 index 000000000000..8aa65daf8578 --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/AsyncErrorMappingTestsetfilesystemaccesspolicy.json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gaprahns.blob.core.windows.net/jtfssetfilesystemaccesspolicy091719f3226da9e92545?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" : "2133405a-1385-4223-9251-18cb4b80230b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77E5A4A4D4A33", + "Last-Modified" : "Wed, 11 Dec 2019 16:50:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07c578f0-e01e-0092-3c43-b0d9cc000000", + "Date" : "Wed, 11 Dec 2019 16:50:55 GMT", + "x-ms-client-request-id" : "2133405a-1385-4223-9251-18cb4b80230b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gaprahns.blob.core.windows.net/jtfssetfilesystemaccesspolicy185772a05001dad96649?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" : "ec77b1c2-ba10-4da7-abf6-0d8359989638" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D77E5A4A685122", + "Last-Modified" : "Wed, 11 Dec 2019 16:50:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07c5796d-e01e-0092-2d43-b0d9cc000000", + "Date" : "Wed, 11 Dec 2019 16:50:55 GMT", + "x-ms-client-request-id" : "ec77b1c2-ba10-4da7-abf6-0d8359989638" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gaprahns.blob.core.windows.net/jtfssetfilesystemaccesspolicy27319595b82ed55c5045?restype=container&comp=acl", + "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" : "d0731857-0c71-4b58-84c4-cdb519ebde71", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "07c579cc-e01e-0092-0843-b0d9cc000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:07c579cc-e01e-0092-0843-b0d9cc000000\nTime:2019-12-11T16:50:55.8022342Z", + "Date" : "Wed, 11 Dec 2019 16:50:55 GMT", + "x-ms-client-request-id" : "d0731857-0c71-4b58-84c4-cdb519ebde71", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gaprahns.blob.core.windows.net?prefix=jtfssetfilesystemaccesspolicy&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" : "86b3d905-ee0b-4803-b705-4636206ab5c4" + }, + "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" : "07c57a18-e01e-0092-4943-b0d9cc000000", + "Body" : "jtfssetfilesystemaccesspolicyjtfssetfilesystemaccesspolicy091719f3226da9e92545Wed, 11 Dec 2019 16:50:55 GMT\"0x8D77E5A4A4D4A33\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfssetfilesystemaccesspolicy185772a05001dad96649Wed, 11 Dec 2019 16:50:55 GMT\"0x8D77E5A4A685122\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Wed, 11 Dec 2019 16:50:55 GMT", + "x-ms-client-request-id" : "86b3d905-ee0b-4803-b705-4636206ab5c4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gaprahns.blob.core.windows.net/jtfssetfilesystemaccesspolicy091719f3226da9e92545?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" : "cfec19ec-e1b3-4c30-8572-7648cef6d704" + }, + "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" : "07c57a2e-e01e-0092-5d43-b0d9cc000000", + "Date" : "Wed, 11 Dec 2019 16:50:55 GMT", + "x-ms-client-request-id" : "cfec19ec-e1b3-4c30-8572-7648cef6d704" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gaprahns.blob.core.windows.net/jtfssetfilesystemaccesspolicy185772a05001dad96649?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" : "566a8362-43c9-404b-bc85-bc6eeae245e0" + }, + "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" : "07c57a42-e01e-0092-6e43-b0d9cc000000", + "Date" : "Wed, 11 Dec 2019 16:50:55 GMT", + "x-ms-client-request-id" : "566a8362-43c9-404b-bc85-bc6eeae245e0" + }, + "Exception" : null + } ], + "variables" : [ "jtfssetfilesystemaccesspolicy091719f3226da9e92545", "jtfssetfilesystemaccesspolicy185772a05001dad96649", "jtfssetfilesystemaccesspolicy27319595b82ed55c5045" ] +} \ No newline at end of file From cf04f6610b403293b4b17c9314a6d78a7abb4ff5 Mon Sep 17 00:00:00 2001 From: Gauri Prasad Date: Wed, 11 Dec 2019 12:14:13 -0800 Subject: [PATCH 06/12] Added changelog --- sdk/storage/azure-storage-file-datalake/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md index 0171f6c6ac98..6cfd7917b3ae 100644 --- a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md +++ b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log azure-storage-file-datalake +## Version XX.X.X-beta.X (XXXX-XX-XX) +- Added SAS generation methods on clients to improve discoverability and convenience of sas. +- Mapped StorageErrorException and BlobStorageException to DataLakeStorageException. + ## 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) From 40ea83fe569e32aefd73a5a7fdf3e58dd72ec05d Mon Sep 17 00:00:00 2001 From: Gauri Prasad Date: Wed, 11 Dec 2019 14:24:12 -0800 Subject: [PATCH 07/12] Changed the way sync methods convert to DataLakeException --- .../file/datalake/DataLakeFileClient.java | 6 +-- .../datalake/DataLakeFileSystemClient.java | 52 +++++++------------ .../file/datalake/DataLakePathClient.java | 24 +++------ .../file/datalake/DataLakeServiceClient.java | 16 +++--- .../util/DataLakeImplUtils.java | 17 +++--- .../DataLakeExceptionMappingPolicy.java | 41 --------------- 6 files changed, 43 insertions(+), 113 deletions(-) delete mode 100644 sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/models/DataLakeExceptionMappingPolicy.java diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileClient.java index 842d16169e63..af5163b3dfdb 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileClient.java @@ -278,14 +278,12 @@ public void read(OutputStream stream) { */ public FileReadResponse readWithResponse(OutputStream stream, FileRange range, DownloadRetryOptions options, DataLakeRequestConditions requestConditions, boolean getRangeContentMd5, Duration timeout, Context context) { - try { + return DataLakeImplUtils.returnOrConvertException(() -> { BlobDownloadResponse response = blockBlobClient.downloadWithResponse(stream, Transforms.toBlobRange(range), Transforms.toBlobDownloadRetryOptions(options), Transforms.toBlobRequestConditions(requestConditions), getRangeContentMd5, timeout, context); return Transforms.toFileReadResponse(response); - } catch (BlobStorageException ex) { - throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); - } + }, logger); } /** diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemClient.java index 4151f41cc5bc..449f304796d0 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemClient.java @@ -197,12 +197,9 @@ public void create() { */ public Response createWithResponse(Map metadata, PublicAccessType accessType, Duration timeout, Context context) { - try { - return blobContainerClient.createWithResponse(metadata, Transforms.toBlobPublicAccessType(accessType), - timeout, context); - } catch (BlobStorageException ex) { - throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); - } + return DataLakeImplUtils.returnOrConvertException(() -> + blobContainerClient.createWithResponse(metadata, Transforms.toBlobPublicAccessType(accessType), timeout, + context), logger); } /** @@ -234,12 +231,9 @@ public void delete() { */ public Response deleteWithResponse(DataLakeRequestConditions requestConditions, Duration timeout, Context context) { - try { - return blobContainerClient.deleteWithResponse(Transforms.toBlobRequestConditions(requestConditions), - timeout, context); - } catch (BlobStorageException ex) { - throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); - } + return DataLakeImplUtils.returnOrConvertException(() -> + blobContainerClient.deleteWithResponse(Transforms.toBlobRequestConditions(requestConditions), timeout, + context), logger); } /** @@ -270,13 +264,11 @@ public FileSystemProperties getProperties() { * @return A response containing the file system properties. */ public Response getPropertiesWithResponse(String leaseId, Duration timeout, Context context) { - try { + return DataLakeImplUtils.returnOrConvertException(() -> { Response response = blobContainerClient.getPropertiesWithResponse(leaseId, timeout, context); return new SimpleResponse<>(response, Transforms.toFileSystemProperties(response.getValue())); - } catch (BlobStorageException ex) { - throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); - } + }, logger); } /** @@ -308,12 +300,9 @@ public void setMetadata(Map metadata) { */ public Response setMetadataWithResponse(Map metadata, DataLakeRequestConditions requestConditions, Duration timeout, Context context) { - try { - return blobContainerClient.setMetadataWithResponse(metadata, - Transforms.toBlobRequestConditions(requestConditions), timeout, context); - } catch (BlobStorageException ex) { - throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); - } + return DataLakeImplUtils.returnOrConvertException(() -> + blobContainerClient.setMetadataWithResponse(metadata, Transforms.toBlobRequestConditions(requestConditions), + timeout, context), logger); } /** @@ -541,13 +530,11 @@ public FileSystemAccessPolicies getAccessPolicy() { */ public Response getAccessPolicyWithResponse(String leaseId, Duration timeout, Context context) { - try { + return DataLakeImplUtils.returnOrConvertException(() -> { Response response = blobContainerClient.getAccessPolicyWithResponse(leaseId, timeout, context); return new SimpleResponse<>(response, Transforms.toFileSystemAccessPolicies(response.getValue())); - } catch (BlobStorageException ex) { - throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); - } + }, logger); } /** @@ -597,14 +584,11 @@ public void setAccessPolicy(PublicAccessType accessType, List setAccessPolicyWithResponse(PublicAccessType accessType, List identifiers, DataLakeRequestConditions requestConditions, Duration timeout, Context context) { - try { - return blobContainerClient - .setAccessPolicyWithResponse(Transforms.toBlobPublicAccessType(accessType), - Transforms.toBlobIdentifierList(identifiers), Transforms.toBlobRequestConditions(requestConditions), - timeout, context); - } catch (BlobStorageException ex) { - throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); - } + return DataLakeImplUtils.returnOrConvertException(() -> + blobContainerClient + .setAccessPolicyWithResponse(Transforms.toBlobPublicAccessType(accessType), + Transforms.toBlobIdentifierList(identifiers), Transforms.toBlobRequestConditions(requestConditions), + timeout, context), logger); } BlobContainerClient getBlobContainerClient() { 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 694f86d25d32..788efbaebeff 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 @@ -194,12 +194,9 @@ public void setMetadata(Map metadata) { */ public Response setMetadataWithResponse(Map metadata, DataLakeRequestConditions requestConditions, Duration timeout, Context context) { - try { - return blockBlobClient.setMetadataWithResponse(metadata, - Transforms.toBlobRequestConditions(requestConditions), timeout, context); - } catch (BlobStorageException ex) { - throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); - } + return DataLakeImplUtils.returnOrConvertException(() -> + blockBlobClient.setMetadataWithResponse(metadata, Transforms.toBlobRequestConditions(requestConditions), + timeout, context), logger); } /** @@ -238,12 +235,9 @@ public void setHttpHeaders(PathHttpHeaders headers) { */ public Response setHttpHeadersWithResponse(PathHttpHeaders headers, DataLakeRequestConditions requestConditions, Duration timeout, Context context) { - try { - return blockBlobClient.setHttpHeadersWithResponse(Transforms.toBlobHttpHeaders(headers), - Transforms.toBlobRequestConditions(requestConditions), timeout, context); - } catch (BlobStorageException ex) { - throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); - } + return DataLakeImplUtils.returnOrConvertException(() -> + blockBlobClient.setHttpHeadersWithResponse(Transforms.toBlobHttpHeaders(headers), + Transforms.toBlobRequestConditions(requestConditions), timeout, context), logger); } /** @@ -410,13 +404,11 @@ public PathProperties getProperties() { */ public Response getPropertiesWithResponse(DataLakeRequestConditions requestConditions, Duration timeout, Context context) { - try { + return DataLakeImplUtils.returnOrConvertException(() -> { Response response = blockBlobClient.getPropertiesWithResponse( Transforms.toBlobRequestConditions(requestConditions), timeout, context); return new SimpleResponse<>(response, Transforms.toPathProperties(response.getValue())); - } catch (BlobStorageException ex) { - throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); - } + }, logger); } /** diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceClient.java index b1511dcf208e..df8aa7b30bea 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceClient.java @@ -12,6 +12,7 @@ import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.BlobServiceClient; +import com.azure.storage.blob.models.BlobProperties; import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.common.StorageSharedKeyCredential; import com.azure.storage.common.sas.AccountSasSignatureValues; @@ -203,12 +204,9 @@ public PagedIterable listFileSystems() { * @return The list of file systems. */ public PagedIterable listFileSystems(ListFileSystemsOptions options, Duration timeout) { - try { - return blobServiceClient.listBlobContainers(Transforms.toListBlobContainersOptions(options), timeout) - .mapPage(Transforms::toFileSystemItem); - } catch (BlobStorageException ex) { - throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); - } + return DataLakeImplUtils.returnOrConvertException(() -> + blobServiceClient.listBlobContainers(Transforms.toListBlobContainersOptions(options), timeout) + .mapPage(Transforms::toFileSystemItem), logger); } /** @@ -243,13 +241,11 @@ public UserDelegationKey getUserDelegationKey(OffsetDateTime start, OffsetDateTi */ public Response getUserDelegationKeyWithResponse(OffsetDateTime start, OffsetDateTime expiry, Duration timeout, Context context) { - try { + return DataLakeImplUtils.returnOrConvertException(() -> { Response response = blobServiceClient .getUserDelegationKeyWithResponse(start, expiry, timeout, context); return new SimpleResponse<>(response, Transforms.toDataLakeUserDelegationKey(response.getValue())); - } catch (BlobStorageException ex) { - throw logger.logExceptionAsError(DataLakeImplUtils.transformBlobStorageException(ex)); - } + }, logger); } /** diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/DataLakeImplUtils.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/DataLakeImplUtils.java index 40ae866df0b2..78a2deb5776a 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/DataLakeImplUtils.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/DataLakeImplUtils.java @@ -3,9 +3,12 @@ package com.azure.storage.file.datalake.implementation.util; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.file.datalake.models.DataLakeStorageException; +import java.util.function.Supplier; + public class DataLakeImplUtils { public static String endpointToDesiredEndpoint(String endpoint, String desiredEndpoint, String currentEndpoint) { // Add the . on either side to prevent overwriting an endpoint if a user provides a @@ -18,7 +21,7 @@ public static String endpointToDesiredEndpoint(String endpoint, String desiredEn } } - public static RuntimeException transformBlobStorageException(RuntimeException ex) { + public static Throwable transformBlobStorageException(Throwable ex) { if (!(ex instanceof BlobStorageException)) { return ex; } else { @@ -28,13 +31,11 @@ public static RuntimeException transformBlobStorageException(RuntimeException ex } } - public static Throwable transformBlobStorageException(Throwable ex) { - if (!(ex instanceof BlobStorageException)) { - return ex; - } else { - BlobStorageException exception = (BlobStorageException) ex; - return new DataLakeStorageException(exception.getServiceMessage(), exception.getResponse(), - exception.getValue()); + public static T returnOrConvertException(Supplier supplier, ClientLogger logger) { + try { + return supplier.get(); + } catch (BlobStorageException ex) { + throw logger.logExceptionAsError((RuntimeException) transformBlobStorageException(ex)); } } } diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/models/DataLakeExceptionMappingPolicy.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/models/DataLakeExceptionMappingPolicy.java deleted file mode 100644 index a6e77f35aaa0..000000000000 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/models/DataLakeExceptionMappingPolicy.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file.datalake.models; - -import com.azure.core.http.HttpPipelineCallContext; -import com.azure.core.http.HttpPipelineNextPolicy; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.policy.HttpPipelinePolicy; -import com.azure.storage.blob.models.BlobStorageException; -import reactor.core.publisher.Mono; - -/** - * This is an exception mapping policy in an HttpPipeline to map BlobStorageExceptions to DataLakeStorageExceptions. - */ -public class DataLakeExceptionMappingPolicy implements HttpPipelinePolicy { - - @Override - public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { - return next.process().onErrorMap(DataLakeExceptionMappingPolicy::transformBlobStorageException); - - } - - /*p - * Remaps the exception returned from a BlobStorageException to a DataLakeStorageException - * - * @param throwable BlobStorageException. - * - * @return Exception remapped to a DataLakeStorageException if the throwable was a BlobStorageException, - * otherwise the throwable is returned unmodified. - */ - private static Throwable transformBlobStorageException(Throwable throwable) { - if (!(throwable instanceof BlobStorageException)) { - return throwable; - } - - BlobStorageException blobStorageException = (BlobStorageException) throwable; - return new DataLakeStorageException(blobStorageException.getServiceMessage(), - blobStorageException.getResponse(), blobStorageException.getValue()); - } -} From d1b8d51df7705e57e256c3215bbd01d3c180b1e6 Mon Sep 17 00:00:00 2001 From: Gauri Prasad Date: Wed, 11 Dec 2019 14:28:59 -0800 Subject: [PATCH 08/12] Removed unused imports --- .../com/azure/storage/file/datalake/DataLakeFileClient.java | 1 - .../azure/storage/file/datalake/DataLakeFileSystemClient.java | 1 - .../com/azure/storage/file/datalake/DataLakePathClient.java | 1 - .../com/azure/storage/file/datalake/DataLakeServiceClient.java | 2 -- 4 files changed, 5 deletions(-) diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileClient.java index af5163b3dfdb..916060663c7f 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileClient.java @@ -9,7 +9,6 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.BlobAsyncClient; import com.azure.storage.blob.models.BlobDownloadResponse; -import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.blob.specialized.BlockBlobClient; import com.azure.storage.common.Utility; import com.azure.storage.common.implementation.StorageImplUtils; diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemClient.java index 449f304796d0..c3c5258f8bf8 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemClient.java @@ -13,7 +13,6 @@ import com.azure.storage.blob.BlobContainerClient; import com.azure.storage.blob.models.BlobContainerAccessPolicies; import com.azure.storage.blob.models.BlobContainerProperties; -import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.common.StorageSharedKeyCredential; import com.azure.storage.file.datalake.implementation.util.DataLakeImplUtils; import com.azure.storage.file.datalake.models.DataLakeRequestConditions; 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 788efbaebeff..a9395f430833 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 @@ -9,7 +9,6 @@ import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.models.BlobProperties; -import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.blob.specialized.BlockBlobClient; import com.azure.storage.common.StorageSharedKeyCredential; import com.azure.storage.common.implementation.StorageImplUtils; diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceClient.java index df8aa7b30bea..c1d0bc593860 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceClient.java @@ -12,8 +12,6 @@ import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.BlobServiceClient; -import com.azure.storage.blob.models.BlobProperties; -import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.common.StorageSharedKeyCredential; import com.azure.storage.common.sas.AccountSasSignatureValues; import com.azure.storage.file.datalake.implementation.util.DataLakeImplUtils; From 1af9c4b4b3cd7347a4fcb81ceb51947a1729f923 Mon Sep 17 00:00:00 2001 From: Gauri Prasad Date: Wed, 11 Dec 2019 14:55:52 -0800 Subject: [PATCH 09/12] Fixed indentation --- .../com/azure/storage/file/datalake/DataLakeFileClient.java | 2 +- .../azure/storage/file/datalake/DataLakeFileSystemClient.java | 4 ++-- .../com/azure/storage/file/datalake/DataLakePathClient.java | 2 +- .../azure/storage/file/datalake/DataLakeServiceClient.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileClient.java index 916060663c7f..4452f5c9e439 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileClient.java @@ -282,7 +282,7 @@ public FileReadResponse readWithResponse(OutputStream stream, FileRange range, D Transforms.toBlobDownloadRetryOptions(options), Transforms.toBlobRequestConditions(requestConditions), getRangeContentMd5, timeout, context); return Transforms.toFileReadResponse(response); - }, logger); + }, logger); } /** diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemClient.java index c3c5258f8bf8..5ccc74d9870d 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemClient.java @@ -267,7 +267,7 @@ public Response getPropertiesWithResponse(String leaseId, Response response = blobContainerClient.getPropertiesWithResponse(leaseId, timeout, context); return new SimpleResponse<>(response, Transforms.toFileSystemProperties(response.getValue())); - }, logger); + }, logger); } /** @@ -533,7 +533,7 @@ public Response getAccessPolicyWithResponse(String lea Response response = blobContainerClient.getAccessPolicyWithResponse(leaseId, timeout, context); return new SimpleResponse<>(response, Transforms.toFileSystemAccessPolicies(response.getValue())); - }, logger); + }, logger); } /** 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 a9395f430833..96636ce90bea 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 @@ -407,7 +407,7 @@ public Response getPropertiesWithResponse(DataLakeRequestConditi Response response = blockBlobClient.getPropertiesWithResponse( Transforms.toBlobRequestConditions(requestConditions), timeout, context); return new SimpleResponse<>(response, Transforms.toPathProperties(response.getValue())); - }, logger); + }, logger); } /** diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceClient.java index c1d0bc593860..d47cd330051d 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceClient.java @@ -243,7 +243,7 @@ public Response getUserDelegationKeyWithResponse(OffsetDateTi Response response = blobServiceClient .getUserDelegationKeyWithResponse(start, expiry, timeout, context); return new SimpleResponse<>(response, Transforms.toDataLakeUserDelegationKey(response.getValue())); - }, logger); + }, logger); } /** From 974aae177236a01537029c93ebcf3dd4b86bb386 Mon Sep 17 00:00:00 2001 From: Gauri Prasad Date: Thu, 12 Dec 2019 13:54:12 -0800 Subject: [PATCH 10/12] Addressed comments from PR --- .../specialized/DataLakeLeaseClient.java | 45 +++++----------- .../datalake/AsyncErrorMappingTest.groovy | 52 +++++-------------- .../LeaseAsyncErrorMappingTest.groovy | 20 ++----- 3 files changed, 30 insertions(+), 87 deletions(-) diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/specialized/DataLakeLeaseClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/specialized/DataLakeLeaseClient.java index 09d7ba366753..8260a13c91bc 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/specialized/DataLakeLeaseClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/specialized/DataLakeLeaseClient.java @@ -10,11 +10,10 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.blob.specialized.BlobLeaseClient; import com.azure.storage.file.datalake.DataLakeFileSystemClient; import com.azure.storage.file.datalake.DataLakePathClient; -import com.azure.storage.file.datalake.models.DataLakeStorageException; +import com.azure.storage.file.datalake.implementation.util.DataLakeImplUtils; import java.net.URL; import java.time.Duration; @@ -105,12 +104,8 @@ public String acquireLease(int duration) { @ServiceMethod(returns = ReturnType.SINGLE) public Response acquireLeaseWithResponse(int duration, RequestConditions modifiedRequestConditions, Duration timeout, Context context) { - try { - return blobLeaseClient.acquireLeaseWithResponse(duration, modifiedRequestConditions, timeout, context); - } catch (BlobStorageException ex) { - throw logger.logExceptionAsError(new DataLakeStorageException(ex.getServiceMessage(), ex.getResponse(), - ex.getValue())); - } + return DataLakeImplUtils.returnOrConvertException(() -> + blobLeaseClient.acquireLeaseWithResponse(duration, modifiedRequestConditions, timeout, context), logger); } /** @@ -144,12 +139,8 @@ public String renewLease() { @ServiceMethod(returns = ReturnType.SINGLE) public Response renewLeaseWithResponse(RequestConditions modifiedRequestConditions, Duration timeout, Context context) { - try { - return blobLeaseClient.renewLeaseWithResponse(modifiedRequestConditions, timeout, context); - } catch (BlobStorageException ex) { - throw logger.logExceptionAsError(new DataLakeStorageException(ex.getServiceMessage(), ex.getResponse(), - ex.getValue())); - } + return DataLakeImplUtils.returnOrConvertException(() -> + blobLeaseClient.renewLeaseWithResponse(modifiedRequestConditions, timeout, context), logger); } /** @@ -181,12 +172,8 @@ public void releaseLease() { @ServiceMethod(returns = ReturnType.SINGLE) public Response releaseLeaseWithResponse(RequestConditions modifiedRequestConditions, Duration timeout, Context context) { - try { - return blobLeaseClient.releaseLeaseWithResponse(modifiedRequestConditions, timeout, context); - } catch (BlobStorageException ex) { - throw logger.logExceptionAsError(new DataLakeStorageException(ex.getServiceMessage(), ex.getResponse(), - ex.getValue())); - } + return DataLakeImplUtils.returnOrConvertException(() -> + blobLeaseClient.releaseLeaseWithResponse(modifiedRequestConditions, timeout, context), logger); } /** @@ -227,13 +214,9 @@ public Integer breakLease() { @ServiceMethod(returns = ReturnType.SINGLE) public Response breakLeaseWithResponse(Integer breakPeriodInSeconds, RequestConditions modifiedRequestConditions, Duration timeout, Context context) { - try { - return blobLeaseClient.breakLeaseWithResponse(breakPeriodInSeconds, modifiedRequestConditions, timeout, - context); - } catch (BlobStorageException ex) { - throw logger.logExceptionAsError(new DataLakeStorageException(ex.getServiceMessage(), ex.getResponse(), - ex.getValue())); - } + return DataLakeImplUtils.returnOrConvertException(() -> + blobLeaseClient.breakLeaseWithResponse(breakPeriodInSeconds, modifiedRequestConditions, timeout, + context), logger); } /** @@ -269,12 +252,8 @@ public String changeLease(String proposedId) { @ServiceMethod(returns = ReturnType.SINGLE) public Response changeLeaseWithResponse(String proposedId, RequestConditions modifiedRequestConditions, Duration timeout, Context context) { - try { - return blobLeaseClient.changeLeaseWithResponse(proposedId, modifiedRequestConditions, timeout, context); - } catch (BlobStorageException ex) { - throw logger.logExceptionAsError(new DataLakeStorageException(ex.getServiceMessage(), ex.getResponse(), - ex.getValue())); - } + return DataLakeImplUtils.returnOrConvertException(() -> + blobLeaseClient.changeLeaseWithResponse(proposedId, modifiedRequestConditions, timeout, context), logger); } /** diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/AsyncErrorMappingTest.groovy b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/AsyncErrorMappingTest.groovy index 26df051a64c8..465a64096266 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/AsyncErrorMappingTest.groovy +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/AsyncErrorMappingTest.groovy @@ -19,9 +19,7 @@ class AsyncErrorMappingTest extends APISpec { def fac = fsac.getFileAsyncClient(fileName) def readFileVerifier = StepVerifier.create(fac.readWithResponse(null, null, null, false)) then: - readFileVerifier.verifyErrorSatisfies { - assert it instanceof DataLakeStorageException - } + readFileVerifier.verifyError(DataLakeStorageException) } def "Get file properties"() { @@ -30,9 +28,7 @@ class AsyncErrorMappingTest extends APISpec { def fac = fsac.getFileAsyncClient(fileName) def getPropertiesVerifier = StepVerifier.create(fac.getPropertiesWithResponse(null)) then: - getPropertiesVerifier.verifyErrorSatisfies { - assert it instanceof DataLakeStorageException - } + getPropertiesVerifier.verifyError(DataLakeStorageException) } def "Set file http properties"() { @@ -41,9 +37,7 @@ class AsyncErrorMappingTest extends APISpec { def fac = fsac.getFileAsyncClient(fileName) def setPropertiesVerifier = StepVerifier.create(fac.setHttpHeadersWithResponse(null, null)) then: - setPropertiesVerifier.verifyErrorSatisfies { - assert it instanceof DataLakeStorageException - } + setPropertiesVerifier.verifyError(DataLakeStorageException) } def "Set file metadata"() { @@ -52,9 +46,7 @@ class AsyncErrorMappingTest extends APISpec { def fac = fsac.getFileAsyncClient(fileName) def setMetadataVerifier = StepVerifier.create(fac.setMetadataWithResponse(null, null)) then: - setMetadataVerifier.verifyErrorSatisfies { - assert it instanceof DataLakeStorageException - } + setMetadataVerifier.verifyError(DataLakeStorageException) } def "Get directory properties"() { @@ -63,9 +55,7 @@ class AsyncErrorMappingTest extends APISpec { def dac = fsac.getDirectoryAsyncClient(directoryName) def getPropertiesVerifier = StepVerifier.create(dac.getPropertiesWithResponse(null)) then: - getPropertiesVerifier.verifyErrorSatisfies { - assert it instanceof DataLakeStorageException - } + getPropertiesVerifier.verifyError(DataLakeStorageException) } def "Set directory http properties"() { @@ -74,9 +64,7 @@ class AsyncErrorMappingTest extends APISpec { def dac = fsac.getDirectoryAsyncClient(directoryName) def setPropertiesVerifier = StepVerifier.create(dac.setHttpHeadersWithResponse(null, null)) then: - setPropertiesVerifier.verifyErrorSatisfies { - assert it instanceof DataLakeStorageException - } + setPropertiesVerifier.verifyError(DataLakeStorageException) } def "Set directory metadata"() { @@ -85,9 +73,7 @@ class AsyncErrorMappingTest extends APISpec { def dac = fsac.getDirectoryAsyncClient(directoryName) def setMetadataVerifier = StepVerifier.create(dac.setMetadataWithResponse(null, null)) then: - setMetadataVerifier.verifyErrorSatisfies { - assert it instanceof DataLakeStorageException - } + setMetadataVerifier.verifyError(DataLakeStorageException) } def "Create file system"() { @@ -95,9 +81,7 @@ class AsyncErrorMappingTest extends APISpec { def fsac = getServiceAsyncClient(primaryCredential).getFileSystemAsyncClient(fileSystemName) def createVerifier = StepVerifier.create(fsac.createWithResponse(null, null)) then: - createVerifier.verifyErrorSatisfies { - assert it instanceof DataLakeStorageException - } + createVerifier.verifyError(DataLakeStorageException) } def "Get file system properties"() { @@ -106,9 +90,7 @@ class AsyncErrorMappingTest extends APISpec { def fsac = getServiceAsyncClient(primaryCredential).getFileSystemAsyncClient(fileSystemName) def getPropertiesVerifier = StepVerifier.create(fsac.getPropertiesWithResponse(null)) then: - getPropertiesVerifier.verifyErrorSatisfies { - assert it instanceof DataLakeStorageException - } + getPropertiesVerifier.verifyError(DataLakeStorageException) } def "Set file system metadata"() { @@ -117,9 +99,7 @@ class AsyncErrorMappingTest extends APISpec { def fsac = getServiceAsyncClient(primaryCredential).getFileSystemAsyncClient(fileSystemName) def setMetadataVerifier = StepVerifier.create(fsac.setMetadataWithResponse(null, null)) then: - setMetadataVerifier.verifyErrorSatisfies { - assert it instanceof DataLakeStorageException - } + setMetadataVerifier.verifyError(DataLakeStorageException) } def "Delete file system"() { @@ -128,9 +108,7 @@ class AsyncErrorMappingTest extends APISpec { def fsac = getServiceAsyncClient(primaryCredential).getFileSystemAsyncClient(fileSystemName) def setMetadataVerifier = StepVerifier.create(fsac.deleteWithResponse(null)) then: - setMetadataVerifier.verifyErrorSatisfies { - assert it instanceof DataLakeStorageException - } + setMetadataVerifier.verifyError(DataLakeStorageException) } def "Get file system access policy"() { @@ -139,9 +117,7 @@ class AsyncErrorMappingTest extends APISpec { def fsac = getServiceAsyncClient(primaryCredential).getFileSystemAsyncClient(fileSystemName) def getAccessPolicyVerifier = StepVerifier.create(fsac.getAccessPolicyWithResponse(null)) then: - getAccessPolicyVerifier.verifyErrorSatisfies { - assert it instanceof DataLakeStorageException - } + getAccessPolicyVerifier.verifyError(DataLakeStorageException) } def "Set file system access policy"() { @@ -150,9 +126,7 @@ class AsyncErrorMappingTest extends APISpec { def fsac = getServiceAsyncClient(primaryCredential).getFileSystemAsyncClient(fileSystemName) def setAccessPolicyVerifier = StepVerifier.create(fsac.setAccessPolicyWithResponse(null, null, null)) then: - setAccessPolicyVerifier.verifyErrorSatisfies { - assert it instanceof DataLakeStorageException - } + setAccessPolicyVerifier.verifyError(DataLakeStorageException) } } diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/specialized/LeaseAsyncErrorMappingTest.groovy b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/specialized/LeaseAsyncErrorMappingTest.groovy index 5e175fdf22b0..0774e312dc45 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/specialized/LeaseAsyncErrorMappingTest.groovy +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/specialized/LeaseAsyncErrorMappingTest.groovy @@ -25,45 +25,35 @@ class LeaseAsyncErrorMappingTest extends APISpec { when: def acquireLeaseVerifier = StepVerifier.create(leaseAsyncClient.acquireLeaseWithResponse(-10, null)) then: - acquireLeaseVerifier.verifyErrorSatisfies { - assert it instanceof DataLakeStorageException - } + acquireLeaseVerifier.verifyError(DataLakeStorageException) } def "Renew Lease"() { when: def renewLeaseVerifier = StepVerifier.create(leaseAsyncClient.renewLeaseWithResponse(null)) then: - renewLeaseVerifier.verifyErrorSatisfies { - assert it instanceof DataLakeStorageException - } + renewLeaseVerifier.verifyError(DataLakeStorageException) } def "Release Lease"() { when: def releaseLeaseVerifier = StepVerifier.create(leaseAsyncClient.releaseLeaseWithResponse(null)) then: - releaseLeaseVerifier.verifyErrorSatisfies { - assert it instanceof DataLakeStorageException - } + releaseLeaseVerifier.verifyError(DataLakeStorageException) } def "Change Lease"() { when: def changeLeaseVerifier = StepVerifier.create(leaseAsyncClient.changeLeaseWithResponse(null, null)) then: - changeLeaseVerifier.verifyErrorSatisfies { - assert it instanceof DataLakeStorageException - } + changeLeaseVerifier.verifyError(DataLakeStorageException) } def "Break Lease"() { when: def breakLeaseVerifier = StepVerifier.create(leaseAsyncClient.breakLeaseWithResponse(null, null)) then: - breakLeaseVerifier.verifyErrorSatisfies { - assert it instanceof DataLakeStorageException - } + breakLeaseVerifier.verifyError(DataLakeStorageException) } } From 460f3e72d8d6863ee568bb379e1fa8221023f2b3 Mon Sep 17 00:00:00 2001 From: Gauri Prasad Date: Thu, 12 Dec 2019 14:06:36 -0800 Subject: [PATCH 11/12] Changed lease async client to match other async clients --- .../datalake/specialized/DataLakeLeaseAsyncClient.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/specialized/DataLakeLeaseAsyncClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/specialized/DataLakeLeaseAsyncClient.java index f599d0f6305d..56c78ba4aaa0 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/specialized/DataLakeLeaseAsyncClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/specialized/DataLakeLeaseAsyncClient.java @@ -104,7 +104,7 @@ public Mono acquireLease(int duration) { public Mono> acquireLeaseWithResponse(int duration, RequestConditions modifiedRequestConditions) { return this.blobLeaseAsyncClient.acquireLeaseWithResponse(duration, modifiedRequestConditions) - .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)); + .onErrorMap(DataLakeImplUtils::transformBlobStorageException); } /** @@ -136,7 +136,7 @@ public Mono renewLease() { @ServiceMethod(returns = ReturnType.SINGLE) public Mono> renewLeaseWithResponse(RequestConditions modifiedRequestConditions) { return blobLeaseAsyncClient.renewLeaseWithResponse(modifiedRequestConditions) - .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)); + .onErrorMap(DataLakeImplUtils::transformBlobStorageException); } /** @@ -168,7 +168,7 @@ public Mono releaseLease() { @ServiceMethod(returns = ReturnType.SINGLE) public Mono> releaseLeaseWithResponse(RequestConditions modifiedRequestConditions) { return blobLeaseAsyncClient.releaseLeaseWithResponse(modifiedRequestConditions) - .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)); + .onErrorMap(DataLakeImplUtils::transformBlobStorageException); } /** @@ -208,7 +208,7 @@ public Mono breakLease() { public Mono> breakLeaseWithResponse(Integer breakPeriodInSeconds, RequestConditions modifiedRequestConditions) { return blobLeaseAsyncClient.breakLeaseWithResponse(breakPeriodInSeconds, modifiedRequestConditions) - .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)); + .onErrorMap(DataLakeImplUtils::transformBlobStorageException); } /** @@ -243,7 +243,7 @@ public Mono changeLease(String proposedId) { public Mono> changeLeaseWithResponse(String proposedId, RequestConditions modifiedRequestConditions) { return blobLeaseAsyncClient.changeLeaseWithResponse(proposedId, modifiedRequestConditions) - .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex)); + .onErrorMap(DataLakeImplUtils::transformBlobStorageException); } /** From 4b2dc9bac5857a4cb41f915c37ea43d39f8078f6 Mon Sep 17 00:00:00 2001 From: Gauri Prasad Date: Thu, 12 Dec 2019 14:17:53 -0800 Subject: [PATCH 12/12] Removed unused import --- .../file/datalake/specialized/DataLakeLeaseAsyncClient.java | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/specialized/DataLakeLeaseAsyncClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/specialized/DataLakeLeaseAsyncClient.java index 56c78ba4aaa0..ea60fd28199d 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/specialized/DataLakeLeaseAsyncClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/specialized/DataLakeLeaseAsyncClient.java @@ -9,7 +9,6 @@ import com.azure.core.http.RequestConditions; import com.azure.core.http.rest.Response; import com.azure.core.util.FluxUtil; -import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.blob.specialized.BlobLeaseAsyncClient; import com.azure.storage.file.datalake.DataLakeDirectoryAsyncClient; import com.azure.storage.file.datalake.DataLakeFileAsyncClient;