From 19e7d05e316c7d7c70c3cd14c290d037e0ab1d9e Mon Sep 17 00:00:00 2001
From: Gauri Prasad
Date: Wed, 11 Dec 2019 16:39:42 -0800
Subject: [PATCH 1/6] Added overloads that do not overwrite by default
---
.../azure-storage-file-datalake/CHANGELOG.md | 1 +
.../datalake/DataLakeFileAsyncClient.java | 34 ++++-
.../file/datalake/DataLakeFileClient.java | 28 +++-
.../datalake/DataLakePathAsyncClient.java | 30 +++-
.../file/datalake/DataLakePathClient.java | 26 +++-
...DataLakeFileAsyncClientJavaDocSamples.java | 6 +
.../DataLakeFileClientJavaDocSamples.java | 6 +
.../PathAsyncClientJavaDocCodeSamples.java | 6 +
.../PathClientJavaDocCodeSamples.java | 5 +
.../storage/file/datalake/APISpec.groovy | 2 +-
.../file/datalake/DirectoryAPITest.groovy | 12 ++
.../storage/file/datalake/FileAPITest.groovy | 24 ++++
.../DirectoryAPITestcreateoverwrite.json | 129 ++++++++++++++++++
.../FileAPITestcreateoverwrite.json | 129 ++++++++++++++++++
.../FileAPITestflushdataoverwrite.json | 129 ++++++++++++++++++
15 files changed, 560 insertions(+), 7 deletions(-)
create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestcreateoverwrite.json
create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/FileAPITestcreateoverwrite.json
create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/FileAPITestflushdataoverwrite.json
diff --git a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md
index 8175f8b8e4cb..8f2513efaf68 100644
--- a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md
+++ b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md
@@ -2,6 +2,7 @@
## Version XXXX-X-X-beta.X (XXXX-XX-XX)
- Added support for exists method on FileClients and DirectoryClients
+- Added support for no overwrite by default on min create method on FileClients and DirectoryClients and flush method on FileClients
## Version 12.0.0-beta.7 (2019-12-04)
This package's
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..a4baf2dd4fcb 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
@@ -12,6 +12,7 @@
import com.azure.core.util.logging.ClientLogger;
import com.azure.storage.blob.BlobContainerAsyncClient;
import com.azure.storage.blob.specialized.BlockBlobAsyncClient;
+import com.azure.storage.common.implementation.Constants;
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;
@@ -216,6 +217,7 @@ Mono> appendWithResponse(Flux data, long fileOffset,
/**
* Flushes (writes) data previously appended to the file through a call to append.
* The previously uploaded data must be contiguous.
+ * By default this method will not overwrite existing data.
*
* Code Samples>Code Samples
*
@@ -231,7 +233,37 @@ Mono> appendWithResponse(Flux data, long fileOffset,
*/
public Mono flush(long position) {
try {
- return flushWithResponse(position, false, false, null, null).flatMap(FluxUtil::toMono);
+ return flush(position, false);
+ } catch (RuntimeException ex) {
+ return monoError(logger, ex);
+ }
+ }
+
+ /**
+ * Flushes (writes) data previously appended to the file through a call to append.
+ * The previously uploaded data must be contiguous.
+ *
+ * Code Samples>Code Samples
+ *
+ * {@codesnippet com.azure.storage.file.datalake.DataLakeFileAsyncClient.flush#long-boolean}
+ *
+ * For more information, see the
+ * Azure
+ * Docs
+ *
+ * @param position The length of the file after all data has been written.
+ * @param overwrite Whether or not to overwrite, should data exist on the file.
+ *
+ * @return A reactive response containing the information of the created resource.
+ */
+ public Mono flush(long position, boolean overwrite) {
+ try {
+ DataLakeRequestConditions requestConditions = null;
+ if (!overwrite) {
+ requestConditions = new DataLakeRequestConditions()
+ .setIfNoneMatch(Constants.HeaderConstants.ETAG_WILDCARD);
+ }
+ return flushWithResponse(position, false, false, null, requestConditions).flatMap(FluxUtil::toMono);
} 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..7382b481fe6a 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
@@ -11,6 +11,7 @@
import com.azure.storage.blob.models.BlobDownloadResponse;
import com.azure.storage.blob.specialized.BlockBlobClient;
import com.azure.storage.common.Utility;
+import com.azure.storage.common.implementation.Constants;
import com.azure.storage.common.implementation.StorageImplUtils;
import com.azure.storage.file.datalake.models.DataLakeRequestConditions;
import com.azure.storage.file.datalake.models.DownloadRetryOptions;
@@ -187,6 +188,7 @@ public Response appendWithResponse(InputStream data, long fileOffset, long
/**
* Flushes (writes) data previously appended to the file through a call to append.
* The previously uploaded data must be contiguous.
+ * By default this method will not overwrite existing data.
*
* Code Samples>Code Samples
*
@@ -201,7 +203,31 @@ public Response appendWithResponse(InputStream data, long fileOffset, long
* @return Information about the created resource.
*/
public PathInfo flush(long position) {
- return flushWithResponse(position, false, false, null, null, null, Context.NONE).getValue();
+ return flush(position, false);
+ }
+
+ /**
+ * Flushes (writes) data previously appended to the file through a call to append.
+ * The previously uploaded data must be contiguous.
+ *
+ * Code Samples>Code Samples
+ *
+ * {@codesnippet com.azure.storage.file.datalake.DataLakeFileClient.flush#long-boolean}
+ *
+ * For more information, see the
+ * Azure
+ * Docs
+ *
+ * @param position The length of the file after all data has been written.
+ *
+ * @return Information about the created resource.
+ */
+ public PathInfo flush(long position, boolean overwrite) {
+ DataLakeRequestConditions requestConditions = null;
+ if (!overwrite) {
+ requestConditions = new DataLakeRequestConditions().setIfNoneMatch(Constants.HeaderConstants.ETAG_WILDCARD);
+ }
+ return flushWithResponse(position, false, false, null, requestConditions, null, Context.NONE).getValue();
}
/**
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 170a668daac5..7aab439c4a44 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
@@ -17,6 +17,7 @@
import com.azure.storage.blob.specialized.SpecializedBlobClientBuilder;
import com.azure.storage.common.StorageSharedKeyCredential;
import com.azure.storage.common.Utility;
+import com.azure.storage.common.implementation.Constants;
import com.azure.storage.file.datalake.implementation.DataLakeStorageClientBuilder;
import com.azure.storage.file.datalake.implementation.DataLakeStorageClientImpl;
import com.azure.storage.file.datalake.implementation.models.LeaseAccessConditions;
@@ -193,7 +194,7 @@ public DataLakeServiceVersion getServiceVersion() {
}
/**
- * Creates a resource.
+ * Creates a resource. By default this method will not overwrite an existing path.
*
* Code Samples
*
@@ -207,7 +208,32 @@ public DataLakeServiceVersion getServiceVersion() {
*/
public Mono create() {
try {
- return createWithResponse(null, null, null, null, null).flatMap(FluxUtil::toMono);
+ return create(false);
+ } catch (RuntimeException ex) {
+ return monoError(logger, ex);
+ }
+ }
+
+ /**
+ * Creates a resource.
+ *
+ * Code Samples
+ *
+ * {@codesnippet com.azure.storage.file.datalake.DataLakePathAsyncClient.create#boolean}
+ *
+ * For more information see the
+ * Azure
+ * Docs
+ *
+ * @return A reactive response containing information about the created resource.
+ */
+ public Mono create(boolean overwrite) {
+ try {
+ DataLakeRequestConditions requestConditions = new DataLakeRequestConditions();
+ if (!overwrite) {
+ requestConditions.setIfNoneMatch(Constants.HeaderConstants.ETAG_WILDCARD);
+ }
+ return createWithResponse(null, null, null, null, requestConditions).flatMap(FluxUtil::toMono);
} 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 1558b5df55dc..8d3e119b767e 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
@@ -11,6 +11,7 @@
import com.azure.storage.blob.models.BlobProperties;
import com.azure.storage.blob.specialized.BlockBlobClient;
import com.azure.storage.common.StorageSharedKeyCredential;
+import com.azure.storage.common.implementation.Constants;
import com.azure.storage.common.implementation.StorageImplUtils;
import com.azure.storage.file.datalake.implementation.models.LeaseAccessConditions;
import com.azure.storage.file.datalake.implementation.models.ModifiedAccessConditions;
@@ -110,7 +111,7 @@ public DataLakeServiceVersion getServiceVersion() {
}
/**
- * Creates a resource.
+ * Creates a resource. By default this method will not overwrite an existing path.
*
* Code Samples
*
@@ -123,7 +124,28 @@ public DataLakeServiceVersion getServiceVersion() {
* @return Information about the created resource.
*/
public PathInfo create() {
- return createWithResponse(null, null, null, null, null, null, Context.NONE).getValue();
+ return create(false);
+ }
+
+ /**
+ * Creates a resource.
+ *
+ * Code Samples
+ *
+ * {@codesnippet com.azure.storage.file.datalake.DataLakePathClient.create#boolean}
+ *
+ * For more information see the
+ * Azure
+ * Docs
+ *
+ * @return Information about the created resource.
+ */
+ public PathInfo create(boolean overwrite) {
+ DataLakeRequestConditions requestConditions = new DataLakeRequestConditions();
+ if (!overwrite) {
+ requestConditions.setIfNoneMatch(Constants.HeaderConstants.ETAG_WILDCARD);
+ }
+ return createWithResponse(null, null, null, null, requestConditions, null, Context.NONE).getValue();
}
/**
diff --git a/sdk/storage/azure-storage-file-datalake/src/samples/java/com/azure/storage/file/datalake/DataLakeFileAsyncClientJavaDocSamples.java b/sdk/storage/azure-storage-file-datalake/src/samples/java/com/azure/storage/file/datalake/DataLakeFileAsyncClientJavaDocSamples.java
index 7477bd2b362d..7355e3d629f4 100644
--- a/sdk/storage/azure-storage-file-datalake/src/samples/java/com/azure/storage/file/datalake/DataLakeFileAsyncClientJavaDocSamples.java
+++ b/sdk/storage/azure-storage-file-datalake/src/samples/java/com/azure/storage/file/datalake/DataLakeFileAsyncClientJavaDocSamples.java
@@ -136,6 +136,12 @@ public void flushCodeSnippets() {
System.out.println("Flush data completed"));
// END: com.azure.storage.file.datalake.DataLakeFileAsyncClient.flush#long
+ // BEGIN: com.azure.storage.file.datalake.DataLakeFileAsyncClient.flush#long-boolean
+ boolean overwrite = true;
+ client.flush(position, overwrite).subscribe(response ->
+ System.out.println("Flush data completed"));
+ // END: com.azure.storage.file.datalake.DataLakeFileAsyncClient.flush#long-boolean
+
// BEGIN: com.azure.storage.file.datalake.DataLakeFileAsyncClient.flushWithResponse#long-boolean-boolean-PathHttpHeaders-DataLakeRequestConditions
FileRange range = new FileRange(1024, 2048L);
DownloadRetryOptions options = new DownloadRetryOptions().setMaxRetryRequests(5);
diff --git a/sdk/storage/azure-storage-file-datalake/src/samples/java/com/azure/storage/file/datalake/DataLakeFileClientJavaDocSamples.java b/sdk/storage/azure-storage-file-datalake/src/samples/java/com/azure/storage/file/datalake/DataLakeFileClientJavaDocSamples.java
index d40739b90857..6b04c75e00b3 100644
--- a/sdk/storage/azure-storage-file-datalake/src/samples/java/com/azure/storage/file/datalake/DataLakeFileClientJavaDocSamples.java
+++ b/sdk/storage/azure-storage-file-datalake/src/samples/java/com/azure/storage/file/datalake/DataLakeFileClientJavaDocSamples.java
@@ -128,6 +128,12 @@ public void flushCodeSnippets() {
System.out.println("Flush data completed");
// END: com.azure.storage.file.datalake.DataLakeFileClient.flush#long
+ // BEGIN: com.azure.storage.file.datalake.DataLakeFileClient.flush#long-boolean
+ boolean overwrite = true;
+ client.flush(position, overwrite);
+ System.out.println("Flush data completed");
+ // END: com.azure.storage.file.datalake.DataLakeFileClient.flush#long-boolean
+
// BEGIN: com.azure.storage.file.datalake.DataLakeFileClient.flushWithResponse#long-boolean-boolean-PathHttpHeaders-DataLakeRequestConditions-Duration-Context
FileRange range = new FileRange(1024, 2048L);
DownloadRetryOptions options = new DownloadRetryOptions().setMaxRetryRequests(5);
diff --git a/sdk/storage/azure-storage-file-datalake/src/samples/java/com/azure/storage/file/datalake/PathAsyncClientJavaDocCodeSamples.java b/sdk/storage/azure-storage-file-datalake/src/samples/java/com/azure/storage/file/datalake/PathAsyncClientJavaDocCodeSamples.java
index b8d89127f4cf..ea7213236d43 100644
--- a/sdk/storage/azure-storage-file-datalake/src/samples/java/com/azure/storage/file/datalake/PathAsyncClientJavaDocCodeSamples.java
+++ b/sdk/storage/azure-storage-file-datalake/src/samples/java/com/azure/storage/file/datalake/PathAsyncClientJavaDocCodeSamples.java
@@ -38,6 +38,12 @@ public void createCodeSnippets() {
System.out.printf("Last Modified Time:%s", response.getLastModified()));
// END: com.azure.storage.file.datalake.DataLakePathAsyncClient.create
+ // BEGIN: com.azure.storage.file.datalake.DataLakePathAsyncClient.create#boolean
+ boolean overwrite = true;
+ client.create(overwrite).subscribe(response ->
+ System.out.printf("Last Modified Time:%s", response.getLastModified()));
+ // END: com.azure.storage.file.datalake.DataLakePathAsyncClient.create#boolean
+
// BEGIN: com.azure.storage.file.datalake.DataLakePathAsyncClient.createWithResponse#String-String-PathHttpHeaders-Map-DataLakeRequestConditions
PathHttpHeaders httpHeaders = new PathHttpHeaders()
.setContentLanguage("en-US")
diff --git a/sdk/storage/azure-storage-file-datalake/src/samples/java/com/azure/storage/file/datalake/PathClientJavaDocCodeSamples.java b/sdk/storage/azure-storage-file-datalake/src/samples/java/com/azure/storage/file/datalake/PathClientJavaDocCodeSamples.java
index ffa4262566a2..98f6e9e067d7 100644
--- a/sdk/storage/azure-storage-file-datalake/src/samples/java/com/azure/storage/file/datalake/PathClientJavaDocCodeSamples.java
+++ b/sdk/storage/azure-storage-file-datalake/src/samples/java/com/azure/storage/file/datalake/PathClientJavaDocCodeSamples.java
@@ -49,6 +49,11 @@ public void createCodeSnippets() {
System.out.printf("Last Modified Time:%s", client.create().getLastModified());
// END: com.azure.storage.file.datalake.DataLakePathClient.create
+ // BEGIN: com.azure.storage.file.datalake.DataLakePathClient.create#boolean
+ boolean overwrite = true;
+ System.out.printf("Last Modified Time:%s", client.create(true).getLastModified());
+ // END: com.azure.storage.file.datalake.DataLakePathClient.create#boolean
+
// BEGIN: com.azure.storage.file.datalake.DataLakePathClient.createWithResponse#String-String-PathHttpHeaders-Map-DataLakeRequestConditions-Duration-Context
PathHttpHeaders httpHeaders = new PathHttpHeaders()
.setContentLanguage("en-US")
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..9aa2e738226a 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
@@ -90,7 +90,7 @@ class APISpec extends Specification {
static final String garbageLeaseID = UUID.randomUUID().toString()
- public static final String defaultEndpointTemplate = "https://%s.dfs.core.windows.net/"
+ public static final String defaultEndpointTemplate = "http://%s.dfs.core.windows.net/"
static def AZURE_TEST_MODE = "AZURE_TEST_MODE"
static def DATA_LAKE_STORAGE = "STORAGE_DATA_LAKE_"
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 761f68166d90..9879af4b1baf 100644
--- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/DirectoryAPITest.groovy
+++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/DirectoryAPITest.groovy
@@ -64,6 +64,18 @@ class DirectoryAPITest extends APISpec {
thrown(Exception)
}
+ def "Create overwrite"() {
+ when:
+ dc = fsc.getDirectoryClient(generatePathName())
+ dc.create()
+
+ // Try to create the resource again
+ dc.create(false)
+
+ then:
+ thrown(StorageErrorException)
+ }
+
def "Exists"() {
when:
dc = fsc.getDirectoryClient(generatePathName())
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 0365804428e8..08f36265e65d 100644
--- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileAPITest.groovy
+++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileAPITest.groovy
@@ -68,6 +68,18 @@ class FileAPITest extends APISpec {
thrown(StorageErrorException)
}
+ def "Create overwrite"() {
+ when:
+ fc = fsc.getFileClient(generatePathName())
+ fc.create()
+
+ // Try to create the resource again
+ fc.create(false)
+
+ then:
+ thrown(StorageErrorException)
+ }
+
def "Exists"() {
when:
fc = fsc.getFileClient(generatePathName())
@@ -1402,6 +1414,18 @@ class FileAPITest extends APISpec {
thrown(StorageErrorException)
}
+ def "Flush data overwrite"() {
+ when:
+ fc.append(new ByteArrayInputStream(defaultData.array()), 0, defaultDataSize)
+ fc.flush(defaultDataSize)
+ fc.append(new ByteArrayInputStream(defaultData.array()), 0, defaultDataSize)
+ // Attempt to write data without overwrite enabled
+ fc.flush(defaultDataSize, false)
+
+ then:
+ thrown(StorageErrorException)
+ }
+
def "Get File Name and Build Client"() {
when:
DataLakeFileClient client = fsc.getFileClient(originalFileName)
diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestcreateoverwrite.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestcreateoverwrite.json
new file mode 100644
index 000000000000..d833ea4999b5
--- /dev/null
+++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestcreateoverwrite.json
@@ -0,0 +1,129 @@
+{
+ "networkCallRecords" : [ {
+ "Method" : "PUT",
+ "Uri" : "http://gaprahns.blob.core.windows.net/jtfscreateoverwrite0directoryapitestcreateoverwriteaab41084c6?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" : "51e95184-b962-46cc-8e4e-f98d1496e4a9"
+ },
+ "Response" : {
+ "x-ms-version" : "2019-02-02",
+ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
+ "ETag" : "0x8D77E9BAD404567",
+ "Last-Modified" : "Thu, 12 Dec 2019 00:38:58 GMT",
+ "retry-after" : "0",
+ "Content-Length" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-id" : "fd2051e9-e01e-007c-3c84-b0d34f000000",
+ "Date" : "Thu, 12 Dec 2019 00:38:58 GMT",
+ "x-ms-client-request-id" : "51e95184-b962-46cc-8e4e-f98d1496e4a9"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "PUT",
+ "Uri" : "http://gaprahns.dfs.core.windows.net/jtfscreateoverwrite0directoryapitestcreateoverwriteaab41084c6/javapathcreateoverwrite158945939f30ffae9e4a429?resource=directory",
+ "Headers" : {
+ "x-ms-version" : "2019-02-02",
+ "User-Agent" : "azsdk-java-azure-storage-file-datalake/12.0.0-beta.8 (11.0.4; Windows 10 10.0)",
+ "x-ms-client-request-id" : "130f50f4-451c-4911-8215-3f0276b6e294"
+ },
+ "Response" : {
+ "x-ms-version" : "2019-02-02",
+ "Server" : "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0",
+ "ETag" : "0x8D77E9BAD5D2879",
+ "Last-Modified" : "Thu, 12 Dec 2019 00:38:58 GMT",
+ "retry-after" : "0",
+ "Content-Length" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-id" : "e1c25cd0-c01f-000d-7584-b0a176000000",
+ "Date" : "Thu, 12 Dec 2019 00:38:58 GMT",
+ "x-ms-client-request-id" : "130f50f4-451c-4911-8215-3f0276b6e294"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "PUT",
+ "Uri" : "http://gaprahns.dfs.core.windows.net/jtfscreateoverwrite0directoryapitestcreateoverwriteaab41084c6/javapathcreateoverwrite22124067e18ab684844e3bb?resource=directory",
+ "Headers" : {
+ "x-ms-version" : "2019-02-02",
+ "User-Agent" : "azsdk-java-azure-storage-file-datalake/12.0.0-beta.8 (11.0.4; Windows 10 10.0)",
+ "x-ms-client-request-id" : "5de21c8c-d9ee-4a8e-8792-40d1bf0050df"
+ },
+ "Response" : {
+ "x-ms-version" : "2019-02-02",
+ "Server" : "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0",
+ "ETag" : "0x8D77E9BAD66BD5B",
+ "Last-Modified" : "Thu, 12 Dec 2019 00:38:59 GMT",
+ "retry-after" : "0",
+ "Content-Length" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-id" : "e1c25cd2-c01f-000d-7784-b0a176000000",
+ "Date" : "Thu, 12 Dec 2019 00:38:58 GMT",
+ "x-ms-client-request-id" : "5de21c8c-d9ee-4a8e-8792-40d1bf0050df"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "PUT",
+ "Uri" : "http://gaprahns.dfs.core.windows.net/jtfscreateoverwrite0directoryapitestcreateoverwriteaab41084c6/javapathcreateoverwrite22124067e18ab684844e3bb?resource=directory",
+ "Headers" : {
+ "x-ms-version" : "2019-02-02",
+ "User-Agent" : "azsdk-java-azure-storage-file-datalake/12.0.0-beta.8 (11.0.4; Windows 10 10.0)",
+ "x-ms-client-request-id" : "52181380-3e08-4765-92ca-d53b3b6f7f2d"
+ },
+ "Response" : {
+ "x-ms-version" : "2019-02-02",
+ "Server" : "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0",
+ "x-ms-error-code" : "PathAlreadyExists",
+ "retry-after" : "0",
+ "Content-Length" : "168",
+ "StatusCode" : "409",
+ "x-ms-request-id" : "e1c25cd3-c01f-000d-7884-b0a176000000",
+ "Body" : "{\"error\":{\"code\":\"PathAlreadyExists\",\"message\":\"The specified path already exists.\\nRequestId:e1c25cd3-c01f-000d-7884-b0a176000000\\nTime:2019-12-12T00:38:59.0983814Z\"}}",
+ "Date" : "Thu, 12 Dec 2019 00:38:58 GMT",
+ "x-ms-client-request-id" : "52181380-3e08-4765-92ca-d53b3b6f7f2d",
+ "Content-Type" : "application/json;charset=utf-8"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "GET",
+ "Uri" : "http://gaprahns.blob.core.windows.net?prefix=jtfscreateoverwrite&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" : "4299efc6-d4a5-4d5a-8faa-33401e6bf350"
+ },
+ "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" : "fd205251-e01e-007c-1484-b0d34f000000",
+ "Body" : "jtfscreateoverwritejtfscreateoverwrite0directoryapitestcreateoverwriteaab41084c6Thu, 12 Dec 2019 00:38:58 GMT\"0x8D77E9BAD404567\"unlockedavailable$account-encryption-keyfalsefalsefalse",
+ "Date" : "Thu, 12 Dec 2019 00:38:58 GMT",
+ "x-ms-client-request-id" : "4299efc6-d4a5-4d5a-8faa-33401e6bf350",
+ "Content-Type" : "application/xml"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "DELETE",
+ "Uri" : "http://gaprahns.blob.core.windows.net/jtfscreateoverwrite0directoryapitestcreateoverwriteaab41084c6?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" : "ea94f840-4ad4-44ed-8038-1c97f442e4c4"
+ },
+ "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" : "fd205273-e01e-007c-2f84-b0d34f000000",
+ "Date" : "Thu, 12 Dec 2019 00:38:58 GMT",
+ "x-ms-client-request-id" : "ea94f840-4ad4-44ed-8038-1c97f442e4c4"
+ },
+ "Exception" : null
+ } ],
+ "variables" : [ "jtfscreateoverwrite0directoryapitestcreateoverwriteaab41084c6", "javapathcreateoverwrite158945939f30ffae9e4a429", "javapathcreateoverwrite22124067e18ab684844e3bb" ]
+}
\ No newline at end of file
diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/FileAPITestcreateoverwrite.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/FileAPITestcreateoverwrite.json
new file mode 100644
index 000000000000..584776e1b389
--- /dev/null
+++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/FileAPITestcreateoverwrite.json
@@ -0,0 +1,129 @@
+{
+ "networkCallRecords" : [ {
+ "Method" : "PUT",
+ "Uri" : "http://gaprahns.blob.core.windows.net/jtfscreateoverwrite0fileapitestcreateoverwritee7602801e9f1?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" : "1d7c6cde-4404-43bc-ae32-39fd0461caa9"
+ },
+ "Response" : {
+ "x-ms-version" : "2019-02-02",
+ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
+ "ETag" : "0x8D77E9B87A990E7",
+ "Last-Modified" : "Thu, 12 Dec 2019 00:37:55 GMT",
+ "retry-after" : "0",
+ "Content-Length" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-id" : "fd200f09-e01e-007c-2084-b0d34f000000",
+ "Date" : "Thu, 12 Dec 2019 00:37:55 GMT",
+ "x-ms-client-request-id" : "1d7c6cde-4404-43bc-ae32-39fd0461caa9"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "PUT",
+ "Uri" : "http://gaprahns.dfs.core.windows.net/jtfscreateoverwrite0fileapitestcreateoverwritee7602801e9f1/javapathcreateoverwrite1fileapitestcreateoverwritee765991278?resource=file",
+ "Headers" : {
+ "x-ms-version" : "2019-02-02",
+ "User-Agent" : "azsdk-java-azure-storage-file-datalake/12.0.0-beta.8 (11.0.4; Windows 10 10.0)",
+ "x-ms-client-request-id" : "4cd528b6-4c3e-4fa6-be54-b04d91fa5440"
+ },
+ "Response" : {
+ "x-ms-version" : "2019-02-02",
+ "Server" : "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0",
+ "ETag" : "0x8D77E9B87F2F078",
+ "Last-Modified" : "Thu, 12 Dec 2019 00:37:56 GMT",
+ "retry-after" : "0",
+ "Content-Length" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-id" : "e1c25b64-c01f-000d-2084-b0a176000000",
+ "Date" : "Thu, 12 Dec 2019 00:37:55 GMT",
+ "x-ms-client-request-id" : "4cd528b6-4c3e-4fa6-be54-b04d91fa5440"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "PUT",
+ "Uri" : "http://gaprahns.dfs.core.windows.net/jtfscreateoverwrite0fileapitestcreateoverwritee7602801e9f1/javapathcreateoverwrite2fileapitestcreateoverwritee7634810ee?resource=file",
+ "Headers" : {
+ "x-ms-version" : "2019-02-02",
+ "User-Agent" : "azsdk-java-azure-storage-file-datalake/12.0.0-beta.8 (11.0.4; Windows 10 10.0)",
+ "x-ms-client-request-id" : "c22e46b6-228e-48d5-9825-8415d6c8b9fd"
+ },
+ "Response" : {
+ "x-ms-version" : "2019-02-02",
+ "Server" : "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0",
+ "ETag" : "0x8D77E9B87FDCE4F",
+ "Last-Modified" : "Thu, 12 Dec 2019 00:37:56 GMT",
+ "retry-after" : "0",
+ "Content-Length" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-id" : "e1c25b66-c01f-000d-2184-b0a176000000",
+ "Date" : "Thu, 12 Dec 2019 00:37:55 GMT",
+ "x-ms-client-request-id" : "c22e46b6-228e-48d5-9825-8415d6c8b9fd"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "PUT",
+ "Uri" : "http://gaprahns.dfs.core.windows.net/jtfscreateoverwrite0fileapitestcreateoverwritee7602801e9f1/javapathcreateoverwrite2fileapitestcreateoverwritee7634810ee?resource=file",
+ "Headers" : {
+ "x-ms-version" : "2019-02-02",
+ "User-Agent" : "azsdk-java-azure-storage-file-datalake/12.0.0-beta.8 (11.0.4; Windows 10 10.0)",
+ "x-ms-client-request-id" : "9bdce872-9e7a-4a8f-8546-3d9a48fa3062"
+ },
+ "Response" : {
+ "x-ms-version" : "2019-02-02",
+ "Server" : "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0",
+ "x-ms-error-code" : "PathAlreadyExists",
+ "retry-after" : "0",
+ "Content-Length" : "168",
+ "StatusCode" : "409",
+ "x-ms-request-id" : "e1c25b67-c01f-000d-2284-b0a176000000",
+ "Body" : "{\"error\":{\"code\":\"PathAlreadyExists\",\"message\":\"The specified path already exists.\\nRequestId:e1c25b67-c01f-000d-2284-b0a176000000\\nTime:2019-12-12T00:37:56.3718836Z\"}}",
+ "Date" : "Thu, 12 Dec 2019 00:37:55 GMT",
+ "x-ms-client-request-id" : "9bdce872-9e7a-4a8f-8546-3d9a48fa3062",
+ "Content-Type" : "application/json;charset=utf-8"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "GET",
+ "Uri" : "http://gaprahns.blob.core.windows.net?prefix=jtfscreateoverwrite&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" : "190b3253-5e9c-47d5-9375-023d7809775b"
+ },
+ "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" : "fd201036-e01e-007c-3284-b0d34f000000",
+ "Body" : "jtfscreateoverwritejtfscreateoverwrite0fileapitestcreateoverwritee7602801e9f1Thu, 12 Dec 2019 00:37:55 GMT\"0x8D77E9B87A990E7\"unlockedavailable$account-encryption-keyfalsefalsefalse",
+ "Date" : "Thu, 12 Dec 2019 00:37:56 GMT",
+ "x-ms-client-request-id" : "190b3253-5e9c-47d5-9375-023d7809775b",
+ "Content-Type" : "application/xml"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "DELETE",
+ "Uri" : "http://gaprahns.blob.core.windows.net/jtfscreateoverwrite0fileapitestcreateoverwritee7602801e9f1?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" : "fe0d09b5-4fab-4deb-a22c-ad7e2786edce"
+ },
+ "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" : "fd20105d-e01e-007c-5484-b0d34f000000",
+ "Date" : "Thu, 12 Dec 2019 00:37:56 GMT",
+ "x-ms-client-request-id" : "fe0d09b5-4fab-4deb-a22c-ad7e2786edce"
+ },
+ "Exception" : null
+ } ],
+ "variables" : [ "jtfscreateoverwrite0fileapitestcreateoverwritee7602801e9f1", "javapathcreateoverwrite1fileapitestcreateoverwritee765991278", "javapathcreateoverwrite2fileapitestcreateoverwritee7634810ee" ]
+}
\ No newline at end of file
diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/FileAPITestflushdataoverwrite.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/FileAPITestflushdataoverwrite.json
new file mode 100644
index 000000000000..7bd3a96a2a61
--- /dev/null
+++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/FileAPITestflushdataoverwrite.json
@@ -0,0 +1,129 @@
+{
+ "networkCallRecords" : [ {
+ "Method" : "PUT",
+ "Uri" : "http://gaprahns.blob.core.windows.net/jtfsflushdataoverwrite0fileapitestflushdataoverwritefef997834?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" : "dba7b674-2ecd-436f-95ec-3241b70f17e3"
+ },
+ "Response" : {
+ "x-ms-version" : "2019-02-02",
+ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
+ "ETag" : "0x8D77E99EDBAE3C3",
+ "Last-Modified" : "Thu, 12 Dec 2019 00:26:27 GMT",
+ "retry-after" : "0",
+ "Content-Length" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-id" : "cbc3bb90-701e-00d8-1a82-b0e9ab000000",
+ "Date" : "Thu, 12 Dec 2019 00:26:27 GMT",
+ "x-ms-client-request-id" : "dba7b674-2ecd-436f-95ec-3241b70f17e3"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "PUT",
+ "Uri" : "http://gaprahns.dfs.core.windows.net/jtfsflushdataoverwrite0fileapitestflushdataoverwritefef997834/javapathflushdataoverwrite126880f420b74c84ce40e?resource=file",
+ "Headers" : {
+ "x-ms-version" : "2019-02-02",
+ "User-Agent" : "azsdk-java-azure-storage-file-datalake/12.0.0-beta.8 (11.0.4; Windows 10 10.0)",
+ "x-ms-client-request-id" : "d17cc7ec-2b83-4ca5-91aa-13878c884e1c"
+ },
+ "Response" : {
+ "x-ms-version" : "2019-02-02",
+ "Server" : "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0",
+ "ETag" : "0x8D77E99EDEE1FD4",
+ "Last-Modified" : "Thu, 12 Dec 2019 00:26:28 GMT",
+ "retry-after" : "0",
+ "Content-Length" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-id" : "758d3c29-601f-00aa-5382-b09895000000",
+ "Date" : "Thu, 12 Dec 2019 00:26:27 GMT",
+ "x-ms-client-request-id" : "d17cc7ec-2b83-4ca5-91aa-13878c884e1c"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "PATCH",
+ "Uri" : "http://gaprahns.dfs.core.windows.net/jtfsflushdataoverwrite0fileapitestflushdataoverwritefef997834/javapathflushdataoverwrite126880f420b74c84ce40e?position=0&action=append",
+ "Headers" : {
+ "x-ms-version" : "2019-02-02",
+ "User-Agent" : "azsdk-java-azure-storage-file-datalake/12.0.0-beta.8 (11.0.4; Windows 10 10.0)",
+ "x-ms-client-request-id" : "34a922ea-1fe0-4014-9e56-a73199d27bd4",
+ "Content-Type" : "application/octet-stream"
+ },
+ "Response" : {
+ "x-ms-version" : "2019-02-02",
+ "Server" : "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0",
+ "retry-after" : "0",
+ "Content-Length" : "0",
+ "StatusCode" : "202",
+ "x-ms-request-server-encrypted" : "true",
+ "x-ms-request-id" : "758d3c2a-601f-00aa-5482-b09895000000",
+ "Date" : "Thu, 12 Dec 2019 00:26:27 GMT",
+ "x-ms-client-request-id" : "34a922ea-1fe0-4014-9e56-a73199d27bd4"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "PATCH",
+ "Uri" : "http://gaprahns.dfs.core.windows.net/jtfsflushdataoverwrite0fileapitestflushdataoverwritefef997834/javapathflushdataoverwrite126880f420b74c84ce40e?position=7&retainUncommittedData=false&close=false&action=flush",
+ "Headers" : {
+ "x-ms-version" : "2019-02-02",
+ "User-Agent" : "azsdk-java-azure-storage-file-datalake/12.0.0-beta.8 (11.0.4; Windows 10 10.0)",
+ "x-ms-client-request-id" : "bbc60eba-8e9b-4cb2-831a-f03da6f5878b"
+ },
+ "Response" : {
+ "x-ms-version" : "2019-02-02",
+ "Server" : "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0",
+ "x-ms-error-code" : "ConditionNotMet",
+ "retry-after" : "0",
+ "Content-Length" : "200",
+ "StatusCode" : "412",
+ "x-ms-request-id" : "758d3c2b-601f-00aa-5582-b09895000000",
+ "Body" : "{\"error\":{\"code\":\"ConditionNotMet\",\"message\":\"The condition specified using HTTP conditional header(s) is not met.\\nRequestId:758d3c2b-601f-00aa-5582-b09895000000\\nTime:2019-12-12T00:26:28.4680557Z\"}}",
+ "Date" : "Thu, 12 Dec 2019 00:26:27 GMT",
+ "x-ms-client-request-id" : "bbc60eba-8e9b-4cb2-831a-f03da6f5878b",
+ "Content-Type" : "application/json;charset=utf-8"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "GET",
+ "Uri" : "http://gaprahns.blob.core.windows.net?prefix=jtfsflushdataoverwrite&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" : "216d5ea6-187e-4e60-b527-0b20f102aea4"
+ },
+ "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" : "cbc3bd31-701e-00d8-0882-b0e9ab000000",
+ "Body" : "jtfsflushdataoverwritejtfsflushdataoverwrite0fileapitestflushdataoverwritefef997834Thu, 12 Dec 2019 00:26:27 GMT\"0x8D77E99EDBAE3C3\"unlockedavailable$account-encryption-keyfalsefalsefalse",
+ "Date" : "Thu, 12 Dec 2019 00:26:27 GMT",
+ "x-ms-client-request-id" : "216d5ea6-187e-4e60-b527-0b20f102aea4",
+ "Content-Type" : "application/xml"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "DELETE",
+ "Uri" : "http://gaprahns.blob.core.windows.net/jtfsflushdataoverwrite0fileapitestflushdataoverwritefef997834?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" : "b276b301-59dc-4e5e-b389-65d469bb2398"
+ },
+ "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" : "cbc3bd7d-701e-00d8-4b82-b0e9ab000000",
+ "Date" : "Thu, 12 Dec 2019 00:26:27 GMT",
+ "x-ms-client-request-id" : "b276b301-59dc-4e5e-b389-65d469bb2398"
+ },
+ "Exception" : null
+ } ],
+ "variables" : [ "jtfsflushdataoverwrite0fileapitestflushdataoverwritefef997834", "javapathflushdataoverwrite126880f420b74c84ce40e" ]
+}
\ No newline at end of file
From 61b958acdcd344a58cb018c95e17a5f4389e98d2 Mon Sep 17 00:00:00 2001
From: Gauri Prasad
Date: Thu, 12 Dec 2019 08:29:32 -0800
Subject: [PATCH 2/6] Added param tags
---
.../com/azure/storage/file/datalake/DataLakeFileClient.java | 1 +
.../azure/storage/file/datalake/DataLakePathAsyncClient.java | 2 ++
.../com/azure/storage/file/datalake/DataLakePathClient.java | 2 ++
3 files changed, 5 insertions(+)
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 7382b481fe6a..41022668dc36 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
@@ -219,6 +219,7 @@ public PathInfo flush(long position) {
* Docs
*
* @param position The length of the file after all data has been written.
+ * @param overwrite Whether or not to overwrite, should data exist on the file.
*
* @return Information about the created resource.
*/
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 7aab439c4a44..4167742d8c7a 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
@@ -225,6 +225,8 @@ public Mono create() {
* Azure
* Docs
*
+ * @param overwrite Whether or not to overwrite, should data exist on the file.
+ *
* @return A reactive response containing information about the created resource.
*/
public Mono create(boolean overwrite) {
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 8d3e119b767e..0dbec1e9ba26 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
@@ -138,6 +138,8 @@ public PathInfo create() {
* Azure
* Docs
*
+ * @param overwrite Whether or not to overwrite, should data exist on the path.
+ *
* @return Information about the created resource.
*/
public PathInfo create(boolean overwrite) {
From 8d4297fd7e104fe86b128da98242b7c75423f994 Mon Sep 17 00:00:00 2001
From: Gauri Prasad
Date: Thu, 12 Dec 2019 14:48:43 -0800
Subject: [PATCH 3/6] Addressed CR feedback
---
.../azure/storage/file/datalake/DataLakeFileAsyncClient.java | 2 +-
.../com/azure/storage/file/datalake/DataLakeFileClient.java | 4 ++--
.../test/java/com/azure/storage/file/datalake/APISpec.groovy | 2 +-
3 files changed, 4 insertions(+), 4 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 ef320a4d8e25..475819fffccf 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
@@ -218,7 +218,7 @@ Mono> appendWithResponse(Flux data, long fileOffset,
/**
* Flushes (writes) data previously appended to the file through a call to append.
* The previously uploaded data must be contiguous.
- * By default this method will not overwrite existing data.
+ * By default this method will not overwrite existing data.
*
* Code Samples>Code Samples
*
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 aa5bab9d9e01..df29def80f17 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
@@ -189,7 +189,7 @@ public Response appendWithResponse(InputStream data, long fileOffset, long
/**
* Flushes (writes) data previously appended to the file through a call to append.
* The previously uploaded data must be contiguous.
- * By default this method will not overwrite existing data.
+ * By default this method will not overwrite existing data.
*
* Code Samples>Code Samples
*
@@ -225,7 +225,7 @@ public PathInfo flush(long position) {
* @return Information about the created resource.
*/
public PathInfo flush(long position, boolean overwrite) {
- DataLakeRequestConditions requestConditions = null;
+ DataLakeRequestConditions requestConditions = new DataLakeRequestConditions();
if (!overwrite) {
requestConditions = new DataLakeRequestConditions().setIfNoneMatch(Constants.HeaderConstants.ETAG_WILDCARD);
}
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 1461896cd239..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
@@ -91,7 +91,7 @@ class APISpec extends Specification {
static final String garbageLeaseID = UUID.randomUUID().toString()
- public static final String defaultEndpointTemplate = "http://%s.dfs.core.windows.net/"
+ public static final String defaultEndpointTemplate = "https://%s.dfs.core.windows.net/"
static def AZURE_TEST_MODE = "AZURE_TEST_MODE"
static def DATA_LAKE_STORAGE = "STORAGE_DATA_LAKE_"
From 86f56daed20d42f5b4beb254c2338aefd60313af Mon Sep 17 00:00:00 2001
From: Gauri Prasad
Date: Thu, 12 Dec 2019 14:54:55 -0800
Subject: [PATCH 4/6] Added onErrorMap for exists
---
.../storage/file/datalake/DataLakePathAsyncClient.java | 10 +++++-----
.../storage/file/datalake/DataLakePathClient.java | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
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 5f61565f484c..20b91b6bfc02 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
@@ -354,7 +354,7 @@ public Mono> setMetadataWithResponse(Map metadata
try {
return this.blockBlobAsyncClient.setMetadataWithResponse(metadata,
Transforms.toBlobRequestConditions(requestConditions))
- .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex));
+ .onErrorMap(DataLakeImplUtils::transformBlobStorageException);
} catch (RuntimeException ex) {
return monoError(logger, ex);
}
@@ -402,7 +402,7 @@ public Mono> setHttpHeadersWithResponse(PathHttpHeaders headers,
try {
return this.blockBlobAsyncClient.setHttpHeadersWithResponse(Transforms.toBlobHttpHeaders(headers),
Transforms.toBlobRequestConditions(requestConditions))
- .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex));
+ .onErrorMap(DataLakeImplUtils::transformBlobStorageException);
} catch (RuntimeException ex) {
return monoError(logger, ex);
}
@@ -444,7 +444,7 @@ public Mono getProperties() {
public Mono> getPropertiesWithResponse(DataLakeRequestConditions requestConditions) {
try {
return blockBlobAsyncClient.getPropertiesWithResponse(Transforms.toBlobRequestConditions(requestConditions))
- .onErrorMap(ex -> DataLakeImplUtils.transformBlobStorageException((BlobStorageException) ex))
+ .onErrorMap(DataLakeImplUtils::transformBlobStorageException)
.map(response -> new SimpleResponse<>(response, Transforms.toPathProperties(response.getValue())));
} catch (RuntimeException ex) {
return monoError(logger, ex);
@@ -479,8 +479,8 @@ public Mono exists() {
*/
public Mono> existsWithResponse() {
try {
- // TODO (gapra) : Once datalake error mapping is merged, add onErrorMap
- return blockBlobAsyncClient.existsWithResponse();
+ return blockBlobAsyncClient.existsWithResponse()
+ .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/DataLakePathClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakePathClient.java
index 173a81109de7..1c1bbe445b92 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
@@ -459,8 +459,8 @@ public Boolean exists() {
* @return true if the path exists, false if it doesn't
*/
public Response existsWithResponse(Duration timeout, Context context) {
- // TODO (gapra) : Once error mapping is merged add error mapping
- return blockBlobClient.existsWithResponse(timeout, context);
+ return DataLakeImplUtils.returnOrConvertException(() ->
+ blockBlobClient.existsWithResponse(timeout, context), logger);
}
/**
From 21f42dfbabd9d1e325a38c5ccf18def6e9a59686 Mon Sep 17 00:00:00 2001
From: Gauri Prasad
Date: Thu, 12 Dec 2019 15:06:26 -0800
Subject: [PATCH 5/6] Changed error type
---
.../java/com/azure/storage/file/datalake/FileAPITest.groovy | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 b7189eb1dfcc..f7f7427f295f 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
@@ -75,7 +75,7 @@ class FileAPITest extends APISpec {
fc.create(false)
then:
- thrown(StorageErrorException)
+ thrown(DataLakeStorageException)
}
def "Exists"() {
From 6e33112f3514997da25db99aa8ebbb552b8615a4 Mon Sep 17 00:00:00 2001
From: Gauri Prasad
Date: Thu, 12 Dec 2019 15:18:27 -0800
Subject: [PATCH 6/6] Fixed CI issues
---
.../azure/storage/file/datalake/DataLakePathAsyncClient.java | 1 -
.../com/azure/storage/file/datalake/DirectoryAPITest.groovy | 5 ++---
.../java/com/azure/storage/file/datalake/FileAPITest.groovy | 2 +-
3 files changed, 3 insertions(+), 5 deletions(-)
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 20b91b6bfc02..e711ab51f185 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,7 +13,6 @@
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;
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 e6ebb24592d0..bbbaae7ad4fe 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
@@ -6,7 +6,6 @@ import com.azure.identity.DefaultAzureCredentialBuilder
import com.azure.storage.blob.BlobUrlParts
import com.azure.storage.blob.models.BlobErrorCode
-import com.azure.storage.file.datalake.implementation.models.StorageErrorException
import com.azure.storage.file.datalake.models.*
import spock.lang.Unroll
@@ -36,7 +35,7 @@ class DirectoryAPITest extends APISpec {
dc.create()
then:
- notThrown(StorageErrorException)
+ notThrown(DataLakeStorageException)
}
def "Create defaults"() {
@@ -72,7 +71,7 @@ class DirectoryAPITest extends APISpec {
dc.create(false)
then:
- thrown(StorageErrorException)
+ thrown(DataLakeStorageException)
}
def "Exists"() {
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 f7f7427f295f..fe001d58c08e 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
@@ -1421,7 +1421,7 @@ class FileAPITest extends APISpec {
fc.flush(defaultDataSize, false)
then:
- thrown(StorageErrorException)
+ thrown(DataLakeStorageException)
}
def "Get File Name and Build Client"() {